Loading res/drawable/ic_gesture_action_volume_down.xml 0 → 100644 +26 −0 Original line number Diff line number Diff line <?xml version="1.0" encoding="utf-8"?> <!-- Copyright (c) 2017 The LineageOS Project Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. --> <vector xmlns:android="http://schemas.android.com/apk/res/android" android:width="24dp" android:height="24dp" android:viewportWidth="24" android:viewportHeight="24"> <path android:fillColor="?android:attr/colorAccent" android:pathData="M18.5,12c0,-1.77 -1.02,-3.29 -2.5,-4.03v8.05c1.48,-0.73 2.5,-2.25 2.5,-4.02zM5,9v6h4l5,5V4L9,9H5z"/> </vector> res/drawable/ic_gesture_action_volume_up.xml 0 → 100644 +26 −0 Original line number Diff line number Diff line <?xml version="1.0" encoding="utf-8"?> <!-- Copyright (c) 2017 The LineageOS Project Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. --> <vector xmlns:android="http://schemas.android.com/apk/res/android" android:width="24dp" android:height="24dp" android:viewportWidth="24" android:viewportHeight="24"> <path android:fillColor="?android:attr/colorAccent" android:pathData="M14,3.23V5.29C16.89,6.15 19,8.83 19,12C19,15.17 16.89,17.84 14,18.7V20.77C18,19.86 21,16.28 21,12C21,7.72 18,4.14 14,3.23M16.5,12C16.5,10.23 15.5,8.71 14,7.97V16C15.5,15.29 16.5,13.76 16.5,12M3,9V15H7L12,20V4L7,9H3Z" /> </vector> res/values/arrays.xml +4 −0 Original line number Diff line number Diff line Loading @@ -308,6 +308,8 @@ <item>@string/touchscreen_gesture_action_play_pause_music</item> <item>@string/touchscreen_gesture_action_previous_track</item> <item>@string/touchscreen_gesture_action_next_track</item> <item>@string/touchscreen_gesture_action_volume_down</item> <item>@string/touchscreen_gesture_action_volume_up</item> </string-array> <string-array name="touchscreen_gesture_action_values"> Loading @@ -321,6 +323,8 @@ <item>7</item> <item>8</item> <item>9</item> <item>10</item> <item>11</item> </string-array> <string-array name="torch_long_press_power_timeout_entries" translatable="false"> Loading res/values/strings.xml +2 −0 Original line number Diff line number Diff line Loading @@ -645,4 +645,6 @@ <string name="touchscreen_gesture_action_play_pause_music">Play/pause music playback</string> <string name="touchscreen_gesture_action_previous_track">Navigate to the previous music track</string> <string name="touchscreen_gesture_action_next_track">Skip to the next music track</string> <string name="touchscreen_gesture_action_volume_down">Lower media volume</string> <string name="touchscreen_gesture_action_volume_up">Raise media volume</string> </resources> src/org/cyanogenmod/cmparts/gestures/KeyHandler.java +22 −3 Original line number Diff line number Diff line Loading @@ -64,6 +64,7 @@ public class KeyHandler implements DeviceKeyHandler { private static final int EVENT_PROCESS_WAKELOCK_DURATION = 500; private final Context mContext; private final AudioManager mAudioManager; private final PowerManager mPowerManager; private final WakeLock mGestureWakeLock; private final EventHandler mEventHandler; Loading Loading @@ -100,6 +101,8 @@ public class KeyHandler implements DeviceKeyHandler { public KeyHandler(final Context context) { mContext = context; mAudioManager = (AudioManager) mContext.getSystemService(Context.AUDIO_SERVICE); mPowerManager = (PowerManager) context.getSystemService(Context.POWER_SERVICE); mGestureWakeLock = mPowerManager.newWakeLock( PowerManager.PARTIAL_WAKE_LOCK, "CMPartsGestureWakeLock"); Loading Loading @@ -235,6 +238,12 @@ public class KeyHandler implements DeviceKeyHandler { case TouchscreenGestureConstants.ACTION_NEXT_TRACK: nextTrack(); break; case TouchscreenGestureConstants.ACTION_VOLUME_DOWN: volumeDown(); break; case TouchscreenGestureConstants.ACTION_VOLUME_UP: volumeUp(); break; } } } Loading Loading @@ -315,6 +324,18 @@ public class KeyHandler implements DeviceKeyHandler { doHapticFeedback(); } private void volumeDown() { mGestureWakeLock.acquire(GESTURE_WAKELOCK_DURATION); mAudioManager.adjustStreamVolume(AudioManager.STREAM_MUSIC, AudioManager.ADJUST_LOWER, 0); doHapticFeedback(); } private void volumeUp() { mGestureWakeLock.acquire(GESTURE_WAKELOCK_DURATION); mAudioManager.adjustStreamVolume(AudioManager.STREAM_MUSIC, AudioManager.ADJUST_RAISE, 0); doHapticFeedback(); } private void dispatchMediaKeyWithWakeLockToMediaSession(final int keycode) { final MediaSessionLegacyHelper helper = MediaSessionLegacyHelper.getHelper(mContext); if (helper == null) { Loading Loading @@ -349,9 +370,7 @@ public class KeyHandler implements DeviceKeyHandler { return; } final AudioManager audioManager = (AudioManager) mContext.getSystemService( Context.AUDIO_SERVICE); if (audioManager.getRingerMode() != AudioManager.RINGER_MODE_SILENT) { if (mAudioManager.getRingerMode() != AudioManager.RINGER_MODE_SILENT) { final boolean enabled = CMSettings.System.getInt(mContext.getContentResolver(), CMSettings.System.TOUCHSCREEN_GESTURE_HAPTIC_FEEDBACK, 1) != 0; if (enabled) { Loading Loading
res/drawable/ic_gesture_action_volume_down.xml 0 → 100644 +26 −0 Original line number Diff line number Diff line <?xml version="1.0" encoding="utf-8"?> <!-- Copyright (c) 2017 The LineageOS Project Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. --> <vector xmlns:android="http://schemas.android.com/apk/res/android" android:width="24dp" android:height="24dp" android:viewportWidth="24" android:viewportHeight="24"> <path android:fillColor="?android:attr/colorAccent" android:pathData="M18.5,12c0,-1.77 -1.02,-3.29 -2.5,-4.03v8.05c1.48,-0.73 2.5,-2.25 2.5,-4.02zM5,9v6h4l5,5V4L9,9H5z"/> </vector>
res/drawable/ic_gesture_action_volume_up.xml 0 → 100644 +26 −0 Original line number Diff line number Diff line <?xml version="1.0" encoding="utf-8"?> <!-- Copyright (c) 2017 The LineageOS Project Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. --> <vector xmlns:android="http://schemas.android.com/apk/res/android" android:width="24dp" android:height="24dp" android:viewportWidth="24" android:viewportHeight="24"> <path android:fillColor="?android:attr/colorAccent" android:pathData="M14,3.23V5.29C16.89,6.15 19,8.83 19,12C19,15.17 16.89,17.84 14,18.7V20.77C18,19.86 21,16.28 21,12C21,7.72 18,4.14 14,3.23M16.5,12C16.5,10.23 15.5,8.71 14,7.97V16C15.5,15.29 16.5,13.76 16.5,12M3,9V15H7L12,20V4L7,9H3Z" /> </vector>
res/values/arrays.xml +4 −0 Original line number Diff line number Diff line Loading @@ -308,6 +308,8 @@ <item>@string/touchscreen_gesture_action_play_pause_music</item> <item>@string/touchscreen_gesture_action_previous_track</item> <item>@string/touchscreen_gesture_action_next_track</item> <item>@string/touchscreen_gesture_action_volume_down</item> <item>@string/touchscreen_gesture_action_volume_up</item> </string-array> <string-array name="touchscreen_gesture_action_values"> Loading @@ -321,6 +323,8 @@ <item>7</item> <item>8</item> <item>9</item> <item>10</item> <item>11</item> </string-array> <string-array name="torch_long_press_power_timeout_entries" translatable="false"> Loading
res/values/strings.xml +2 −0 Original line number Diff line number Diff line Loading @@ -645,4 +645,6 @@ <string name="touchscreen_gesture_action_play_pause_music">Play/pause music playback</string> <string name="touchscreen_gesture_action_previous_track">Navigate to the previous music track</string> <string name="touchscreen_gesture_action_next_track">Skip to the next music track</string> <string name="touchscreen_gesture_action_volume_down">Lower media volume</string> <string name="touchscreen_gesture_action_volume_up">Raise media volume</string> </resources>
src/org/cyanogenmod/cmparts/gestures/KeyHandler.java +22 −3 Original line number Diff line number Diff line Loading @@ -64,6 +64,7 @@ public class KeyHandler implements DeviceKeyHandler { private static final int EVENT_PROCESS_WAKELOCK_DURATION = 500; private final Context mContext; private final AudioManager mAudioManager; private final PowerManager mPowerManager; private final WakeLock mGestureWakeLock; private final EventHandler mEventHandler; Loading Loading @@ -100,6 +101,8 @@ public class KeyHandler implements DeviceKeyHandler { public KeyHandler(final Context context) { mContext = context; mAudioManager = (AudioManager) mContext.getSystemService(Context.AUDIO_SERVICE); mPowerManager = (PowerManager) context.getSystemService(Context.POWER_SERVICE); mGestureWakeLock = mPowerManager.newWakeLock( PowerManager.PARTIAL_WAKE_LOCK, "CMPartsGestureWakeLock"); Loading Loading @@ -235,6 +238,12 @@ public class KeyHandler implements DeviceKeyHandler { case TouchscreenGestureConstants.ACTION_NEXT_TRACK: nextTrack(); break; case TouchscreenGestureConstants.ACTION_VOLUME_DOWN: volumeDown(); break; case TouchscreenGestureConstants.ACTION_VOLUME_UP: volumeUp(); break; } } } Loading Loading @@ -315,6 +324,18 @@ public class KeyHandler implements DeviceKeyHandler { doHapticFeedback(); } private void volumeDown() { mGestureWakeLock.acquire(GESTURE_WAKELOCK_DURATION); mAudioManager.adjustStreamVolume(AudioManager.STREAM_MUSIC, AudioManager.ADJUST_LOWER, 0); doHapticFeedback(); } private void volumeUp() { mGestureWakeLock.acquire(GESTURE_WAKELOCK_DURATION); mAudioManager.adjustStreamVolume(AudioManager.STREAM_MUSIC, AudioManager.ADJUST_RAISE, 0); doHapticFeedback(); } private void dispatchMediaKeyWithWakeLockToMediaSession(final int keycode) { final MediaSessionLegacyHelper helper = MediaSessionLegacyHelper.getHelper(mContext); if (helper == null) { Loading Loading @@ -349,9 +370,7 @@ public class KeyHandler implements DeviceKeyHandler { return; } final AudioManager audioManager = (AudioManager) mContext.getSystemService( Context.AUDIO_SERVICE); if (audioManager.getRingerMode() != AudioManager.RINGER_MODE_SILENT) { if (mAudioManager.getRingerMode() != AudioManager.RINGER_MODE_SILENT) { final boolean enabled = CMSettings.System.getInt(mContext.getContentResolver(), CMSettings.System.TOUCHSCREEN_GESTURE_HAPTIC_FEEDBACK, 1) != 0; if (enabled) { Loading