From 7a8116b2cf44c00bbe31689ec0b556a304ffb84f Mon Sep 17 00:00:00 2001 From: Stypox Date: Tue, 4 Apr 2023 09:47:51 +0200 Subject: [PATCH 01/16] Remove "ExoPlayer settings" from 0.25.1 changelogs Also remove "hi" changelog completely, as it was not really translated --- fastlane/metadata/android/cs/changelogs/993.txt | 1 - fastlane/metadata/android/en-US/changelogs/993.txt | 1 - fastlane/metadata/android/es/changelogs/993.txt | 1 - fastlane/metadata/android/hi/changelogs/993.txt | 13 ------------- fastlane/metadata/android/it/changelogs/993.txt | 1 - fastlane/metadata/android/pa/changelogs/993.txt | 1 - fastlane/metadata/android/pl/changelogs/993.txt | 1 - fastlane/metadata/android/pt-PT/changelogs/993.txt | 1 - fastlane/metadata/android/pt/changelogs/993.txt | 1 - fastlane/metadata/android/ru/changelogs/993.txt | 1 - fastlane/metadata/android/uk/changelogs/993.txt | 1 - .../metadata/android/zh-Hant/changelogs/993.txt | 1 - .../metadata/android/zh_Hant_HK/changelogs/993.txt | 1 - 13 files changed, 25 deletions(-) delete mode 100644 fastlane/metadata/android/hi/changelogs/993.txt diff --git a/fastlane/metadata/android/cs/changelogs/993.txt b/fastlane/metadata/android/cs/changelogs/993.txt index 3df0fe64b..2d57d44a1 100644 --- a/fastlane/metadata/android/cs/changelogs/993.txt +++ b/fastlane/metadata/android/cs/changelogs/993.txt @@ -10,4 +10,3 @@ Vylepšeno Opraveno • Oprava otevírání URL prohlížeče, stahování a externích přehrávačů v Android 11+ • Oprava interakce s celou obrazovkou v MIUI -• Úpravy nastavení ExoPlayer pro opravu přehrávání na některých zařízeních diff --git a/fastlane/metadata/android/en-US/changelogs/993.txt b/fastlane/metadata/android/en-US/changelogs/993.txt index 5d45efd13..722bc50cf 100644 --- a/fastlane/metadata/android/en-US/changelogs/993.txt +++ b/fastlane/metadata/android/en-US/changelogs/993.txt @@ -10,4 +10,3 @@ Improved Fixed • Fix opening browser URLs, downloads and external players on Android 11+ • Fix interacting with fullscreen requiring two taps on MIUI -• Allow tweaking ExoPlayer settings to fix playback on some devices \ No newline at end of file diff --git a/fastlane/metadata/android/es/changelogs/993.txt b/fastlane/metadata/android/es/changelogs/993.txt index 66c147a42..f951484e0 100644 --- a/fastlane/metadata/android/es/changelogs/993.txt +++ b/fastlane/metadata/android/es/changelogs/993.txt @@ -10,4 +10,3 @@ Mejorado Solucionado • Abrir URL del navegador, descargas y reproductores externos en Android 11+ • Interación en pantalla completa, requería dos toques en MIUI -• Cambiar la configuración de ExoPlayer para la reproducción en algunos dispositivos diff --git a/fastlane/metadata/android/hi/changelogs/993.txt b/fastlane/metadata/android/hi/changelogs/993.txt deleted file mode 100644 index e3aa57e5f..000000000 --- a/fastlane/metadata/android/hi/changelogs/993.txt +++ /dev/null @@ -1,13 +0,0 @@ -New -• Add warning when adding playlist duplicates and add button to remove them -• Allow ignoring hardware buttons -• Allow hiding partially watched videos in feed - -Improved -• Use more grid columns on big screens -• Make progress indicators consistent with settings - -Fixed -• Fix opening browser URLs, downloads and external players on Android 11+ -• Fix interacting with fullscreen requiring two taps on MIUI -• Allow tweaking ExoPlayer settings to fix playback on some devices diff --git a/fastlane/metadata/android/it/changelogs/993.txt b/fastlane/metadata/android/it/changelogs/993.txt index b7098fd24..ecaf530d2 100644 --- a/fastlane/metadata/android/it/changelogs/993.txt +++ b/fastlane/metadata/android/it/changelogs/993.txt @@ -10,4 +10,3 @@ Migliorato Corretto • Fix apertura URL, download e player esterni su Android 11+ • Fix interazione con schermo intero che richiedeva due otcchi su MIUI -• Regola le impostazioni di ExoPlayer per correggere la riproduzione su alcuni dispositivi diff --git a/fastlane/metadata/android/pa/changelogs/993.txt b/fastlane/metadata/android/pa/changelogs/993.txt index 6fad07e20..e83950724 100644 --- a/fastlane/metadata/android/pa/changelogs/993.txt +++ b/fastlane/metadata/android/pa/changelogs/993.txt @@ -10,4 +10,3 @@ ਠੀਕ ਕੀਤੇ • Android 11 'ਤੇ ਖੋਲ੍ਹਣ ਵਾਲੇ ਬ੍ਰਾਊਜ਼ਰ URL, ਡਾਊਨਲੋਡ ਅਤੇ ਬਾਹਰੀ ਪਲੇਅਰ ਨੂੰ ਠੀਕ ਕਰੋ • MIUI 'ਤੇ ਦੋ ਟੈਪਾਂ ਦੀ ਲੋੜ ਵਾਲੀ ਪੂਰੀ ਸਕ੍ਰੀਨ ਨਾਲ ਇੰਟਰੈਕਟਿੰਗ ਨੂੰ ਠੀਕ ਕਰੋ -• ਕੁਝ ਡਿਵਾਈਸਾਂ 'ਤੇ ਪਲੇਬੈਕ ਨੂੰ ਠੀਕ ਕਰਨ ਲਈ ExoPlayer ਸੈਟਿੰਗਾਂ ਨੂੰ ਟਵੀਕ ਕਰਨ ਦਿਓ diff --git a/fastlane/metadata/android/pl/changelogs/993.txt b/fastlane/metadata/android/pl/changelogs/993.txt index 38cd01325..a24d4077e 100644 --- a/fastlane/metadata/android/pl/changelogs/993.txt +++ b/fastlane/metadata/android/pl/changelogs/993.txt @@ -10,4 +10,3 @@ Ulepszone Naprawione • Otwier. URL-i przeglądarki, pobranych i zew. odtwarzaczy na Androidzie 11+ • Interakcja z trybem pełnoekr. wymagającym dwóch naciśnięć na MIUI -• Dostosow. ustawień ExoPlayera, aby naprawić odtwarzanie na niektórych urządz. diff --git a/fastlane/metadata/android/pt-PT/changelogs/993.txt b/fastlane/metadata/android/pt-PT/changelogs/993.txt index 7f06f8081..80c7b25f5 100644 --- a/fastlane/metadata/android/pt-PT/changelogs/993.txt +++ b/fastlane/metadata/android/pt-PT/changelogs/993.txt @@ -10,4 +10,3 @@ Melhorado Fixa - Corrigir URLs de abertura do navegador, downloads e leitores externos no Android 11+ - Fixação interagindo com tela cheia requer duas torneiras no MIUI -- Permitir ajustes no ExoPlayer para fixar a reprodução em alguns dispositivos diff --git a/fastlane/metadata/android/pt/changelogs/993.txt b/fastlane/metadata/android/pt/changelogs/993.txt index 7f06f8081..80c7b25f5 100644 --- a/fastlane/metadata/android/pt/changelogs/993.txt +++ b/fastlane/metadata/android/pt/changelogs/993.txt @@ -10,4 +10,3 @@ Melhorado Fixa - Corrigir URLs de abertura do navegador, downloads e leitores externos no Android 11+ - Fixação interagindo com tela cheia requer duas torneiras no MIUI -- Permitir ajustes no ExoPlayer para fixar a reprodução em alguns dispositivos diff --git a/fastlane/metadata/android/ru/changelogs/993.txt b/fastlane/metadata/android/ru/changelogs/993.txt index ea26a1aff..dc0f2f638 100644 --- a/fastlane/metadata/android/ru/changelogs/993.txt +++ b/fastlane/metadata/android/ru/changelogs/993.txt @@ -10,4 +10,3 @@ Исправления • Исправлено открытие URL-адресов браузера, загрузок и внешних проигрывателей на Android 11+ • Исправлено взаимодействие с полноэкранным режимом, требующее двух нажатий в MIUI -• Разрешить изменять настройки ExoPlayer, чтобы исправить воспроизведение на некоторых устройствах diff --git a/fastlane/metadata/android/uk/changelogs/993.txt b/fastlane/metadata/android/uk/changelogs/993.txt index 1ce103bca..7b540cda2 100644 --- a/fastlane/metadata/android/uk/changelogs/993.txt +++ b/fastlane/metadata/android/uk/changelogs/993.txt @@ -10,4 +10,3 @@ Виправлено • Відкриття URL-адрес браузера, завантажень і зовнішніх програвачів на Android 11+ • Роботу повноекранного режиму, який вимагав двох дотиків у MIUI -• Дозвіл змінювати налаштування ExoPlayer, щоб виправити відтворення на деяких пристроях diff --git a/fastlane/metadata/android/zh-Hant/changelogs/993.txt b/fastlane/metadata/android/zh-Hant/changelogs/993.txt index edb1f70fe..0a095cff9 100644 --- a/fastlane/metadata/android/zh-Hant/changelogs/993.txt +++ b/fastlane/metadata/android/zh-Hant/changelogs/993.txt @@ -10,4 +10,3 @@ 修正 • 修正 Android 11+ 上開啟瀏覽器 URL、下載與外部播放器 • 修正 MIUI 上全螢幕操作需要輕觸兩下 -• 允許微調 ExoPlayer 設定以修正部分裝置上的播放問題 diff --git a/fastlane/metadata/android/zh_Hant_HK/changelogs/993.txt b/fastlane/metadata/android/zh_Hant_HK/changelogs/993.txt index 754da7342..76e24fb31 100644 --- a/fastlane/metadata/android/zh_Hant_HK/changelogs/993.txt +++ b/fastlane/metadata/android/zh_Hant_HK/changelogs/993.txt @@ -10,4 +10,3 @@ 執漏 • 修正 Android 11+ 開啟瀏覽器 URL、下載同外面播放器 • 修正 MIUI 全螢幕時要撳兩下至搞得掂 -• 有得調校 ExoPlayer 設定解決某啲機播唔到片嘅問題 From 3c74cb3439bd64f7ac92add78e0492e04afaa334 Mon Sep 17 00:00:00 2001 From: ge78fug Date: Fri, 20 Jan 2023 16:35:47 +0100 Subject: [PATCH 02/16] Created a setting to switch the sides of volume and brightness --- .../gesture/MainPlayerGestureListener.kt | 13 +++++++++--- .../settings/VideoAudioSettingsFragment.java | 20 +++++++++++++++++++ app/src/main/res/values/settings_keys.xml | 1 + app/src/main/res/values/strings.xml | 2 ++ app/src/main/res/xml/video_audio_settings.xml | 8 ++++++++ 5 files changed, 41 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/org/schabi/newpipe/player/gesture/MainPlayerGestureListener.kt b/app/src/main/java/org/schabi/newpipe/player/gesture/MainPlayerGestureListener.kt index a6dba0dd5..75a27896d 100644 --- a/app/src/main/java/org/schabi/newpipe/player/gesture/MainPlayerGestureListener.kt +++ b/app/src/main/java/org/schabi/newpipe/player/gesture/MainPlayerGestureListener.kt @@ -9,6 +9,7 @@ import androidx.appcompat.app.AppCompatActivity import androidx.appcompat.content.res.AppCompatResources import androidx.core.math.MathUtils import androidx.core.view.isVisible +import androidx.preference.PreferenceManager import org.schabi.newpipe.MainActivity import org.schabi.newpipe.R import org.schabi.newpipe.ktx.AnimationType @@ -193,10 +194,16 @@ class MainPlayerGestureListener( isMoving = true // -- Brightness and Volume control -- - val isBrightnessGestureEnabled = PlayerHelper.isBrightnessGestureEnabled(player.context) - val isVolumeGestureEnabled = PlayerHelper.isVolumeGestureEnabled(player.context) + var isBrightnessGestureEnabled = PlayerHelper.isBrightnessGestureEnabled(player.context) + var isVolumeGestureEnabled = PlayerHelper.isVolumeGestureEnabled(player.context) + var displaySide = DisplayPortion.LEFT_HALF + val sidesSwitched = PreferenceManager.getDefaultSharedPreferences(player.context) + .getBoolean(R.string.switch_gesture_sides_key.toString(), false) + if (sidesSwitched) { + displaySide = DisplayPortion.RIGHT_HALF + } if (isBrightnessGestureEnabled && isVolumeGestureEnabled) { - if (getDisplayHalfPortion(initialEvent) === DisplayPortion.LEFT_HALF) { + if (getDisplayHalfPortion(initialEvent) === displaySide) { onScrollBrightness(distanceY) } else /* DisplayPortion.RIGHT_HALF */ { onScrollVolume(distanceY) diff --git a/app/src/main/java/org/schabi/newpipe/settings/VideoAudioSettingsFragment.java b/app/src/main/java/org/schabi/newpipe/settings/VideoAudioSettingsFragment.java index aae9cfca5..4936f979b 100644 --- a/app/src/main/java/org/schabi/newpipe/settings/VideoAudioSettingsFragment.java +++ b/app/src/main/java/org/schabi/newpipe/settings/VideoAudioSettingsFragment.java @@ -6,8 +6,11 @@ import android.os.Build; import android.os.Bundle; import android.provider.Settings; import android.text.format.DateUtils; +import android.view.View; import android.widget.Toast; +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; import androidx.preference.ListPreference; import com.google.android.material.snackbar.Snackbar; @@ -21,6 +24,17 @@ import java.util.List; public class VideoAudioSettingsFragment extends BasePreferenceFragment { private SharedPreferences.OnSharedPreferenceChangeListener listener; + @Override + public void onViewCreated(@NonNull final View rootView, + @Nullable final Bundle savedInstanceState) { + super.onViewCreated(rootView, savedInstanceState); + findPreference(getString(R.string.switch_gesture_sides_key)) + .setEnabled(getPreferenceManager().getSharedPreferences() + .getBoolean(getString(R.string.volume_gesture_control_key), true) + && getPreferenceManager().getSharedPreferences() + .getBoolean(getString(R.string.brightness_gesture_control_key), true)); + } + @Override public void onCreatePreferences(final Bundle savedInstanceState, final String rootKey) { addPreferencesFromResourceRegistry(); @@ -29,6 +43,12 @@ public class VideoAudioSettingsFragment extends BasePreferenceFragment { listener = (sharedPreferences, key) -> { + findPreference(getString(R.string.switch_gesture_sides_key)) + .setEnabled(sharedPreferences.getBoolean( + getString(R.string.volume_gesture_control_key), true) + && sharedPreferences.getBoolean( + getString(R.string.brightness_gesture_control_key), true)); + // on M and above, if user chooses to minimise to popup player on exit // and the app doesn't have display over other apps permission, // show a snackbar to let the user give permission diff --git a/app/src/main/res/values/settings_keys.xml b/app/src/main/res/values/settings_keys.xml index 6a1d5cd45..dae8cc113 100644 --- a/app/src/main/res/values/settings_keys.xml +++ b/app/src/main/res/values/settings_keys.xml @@ -18,6 +18,7 @@ volume_gesture_control brightness_gesture_control + switch_gesture_sides resume_on_audio_focus_gain popup_remember_size_pos_key use_inexact_seek_key diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index dd8b8a58d..67acdcf0c 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -105,6 +105,8 @@ Use gestures to control player volume Brightness gesture control Use gestures to control player brightness + Switch gesture sides + Switches the sides of the volume and brightness gesture controls Search suggestions Choose the suggestions to show when searching Local search suggestions diff --git a/app/src/main/res/xml/video_audio_settings.xml b/app/src/main/res/xml/video_audio_settings.xml index 117ee8703..da932bb38 100644 --- a/app/src/main/res/xml/video_audio_settings.xml +++ b/app/src/main/res/xml/video_audio_settings.xml @@ -190,6 +190,14 @@ app:singleLineTitle="false" app:iconSpaceReserved="false" /> + + Date: Fri, 20 Jan 2023 22:48:10 +0100 Subject: [PATCH 03/16] Update app/src/main/java/org/schabi/newpipe/player/gesture/MainPlayerGestureListener.kt Co-authored-by: Stypox --- .../newpipe/player/gesture/MainPlayerGestureListener.kt | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/app/src/main/java/org/schabi/newpipe/player/gesture/MainPlayerGestureListener.kt b/app/src/main/java/org/schabi/newpipe/player/gesture/MainPlayerGestureListener.kt index 75a27896d..d6dc37e95 100644 --- a/app/src/main/java/org/schabi/newpipe/player/gesture/MainPlayerGestureListener.kt +++ b/app/src/main/java/org/schabi/newpipe/player/gesture/MainPlayerGestureListener.kt @@ -196,12 +196,9 @@ class MainPlayerGestureListener( // -- Brightness and Volume control -- var isBrightnessGestureEnabled = PlayerHelper.isBrightnessGestureEnabled(player.context) var isVolumeGestureEnabled = PlayerHelper.isVolumeGestureEnabled(player.context) - var displaySide = DisplayPortion.LEFT_HALF - val sidesSwitched = PreferenceManager.getDefaultSharedPreferences(player.context) - .getBoolean(R.string.switch_gesture_sides_key.toString(), false) - if (sidesSwitched) { - displaySide = DisplayPortion.RIGHT_HALF - } + val brightnessSide = if (PreferenceManager.getDefaultSharedPreferences(player.context) + .getBoolean(R.string.switch_gesture_sides_key.toString(), false)) DisplayPortion.RIGHT_HALF + else DisplayPortion.LEFT_HALF if (isBrightnessGestureEnabled && isVolumeGestureEnabled) { if (getDisplayHalfPortion(initialEvent) === displaySide) { onScrollBrightness(distanceY) From c8d54ec6c77d172bf51dc5d6988aee953375bc6e Mon Sep 17 00:00:00 2001 From: ge78fug Date: Fri, 20 Jan 2023 23:10:55 +0100 Subject: [PATCH 04/16] Changed to val --- .../newpipe/player/gesture/MainPlayerGestureListener.kt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/org/schabi/newpipe/player/gesture/MainPlayerGestureListener.kt b/app/src/main/java/org/schabi/newpipe/player/gesture/MainPlayerGestureListener.kt index d6dc37e95..3c40f714e 100644 --- a/app/src/main/java/org/schabi/newpipe/player/gesture/MainPlayerGestureListener.kt +++ b/app/src/main/java/org/schabi/newpipe/player/gesture/MainPlayerGestureListener.kt @@ -194,13 +194,13 @@ class MainPlayerGestureListener( isMoving = true // -- Brightness and Volume control -- - var isBrightnessGestureEnabled = PlayerHelper.isBrightnessGestureEnabled(player.context) - var isVolumeGestureEnabled = PlayerHelper.isVolumeGestureEnabled(player.context) + val isBrightnessGestureEnabled = PlayerHelper.isBrightnessGestureEnabled(player.context) + val isVolumeGestureEnabled = PlayerHelper.isVolumeGestureEnabled(player.context) val brightnessSide = if (PreferenceManager.getDefaultSharedPreferences(player.context) .getBoolean(R.string.switch_gesture_sides_key.toString(), false)) DisplayPortion.RIGHT_HALF else DisplayPortion.LEFT_HALF if (isBrightnessGestureEnabled && isVolumeGestureEnabled) { - if (getDisplayHalfPortion(initialEvent) === displaySide) { + if (getDisplayHalfPortion(initialEvent) === brightnessSide) { onScrollBrightness(distanceY) } else /* DisplayPortion.RIGHT_HALF */ { onScrollVolume(distanceY) From 2ba649949fbb6968706dfa5e3058ad7a4fbfcf7e Mon Sep 17 00:00:00 2001 From: ge78fug Date: Sat, 21 Jan 2023 17:11:45 +0100 Subject: [PATCH 05/16] Updated the gesture-switch-toggle --- .../gesture/MainPlayerGestureListener.kt | 5 ++- .../settings/VideoAudioSettingsFragment.java | 40 +++++++++---------- app/src/main/res/values/strings.xml | 1 + 3 files changed, 24 insertions(+), 22 deletions(-) diff --git a/app/src/main/java/org/schabi/newpipe/player/gesture/MainPlayerGestureListener.kt b/app/src/main/java/org/schabi/newpipe/player/gesture/MainPlayerGestureListener.kt index 3c40f714e..960edbce2 100644 --- a/app/src/main/java/org/schabi/newpipe/player/gesture/MainPlayerGestureListener.kt +++ b/app/src/main/java/org/schabi/newpipe/player/gesture/MainPlayerGestureListener.kt @@ -197,8 +197,9 @@ class MainPlayerGestureListener( val isBrightnessGestureEnabled = PlayerHelper.isBrightnessGestureEnabled(player.context) val isVolumeGestureEnabled = PlayerHelper.isVolumeGestureEnabled(player.context) val brightnessSide = if (PreferenceManager.getDefaultSharedPreferences(player.context) - .getBoolean(R.string.switch_gesture_sides_key.toString(), false)) DisplayPortion.RIGHT_HALF - else DisplayPortion.LEFT_HALF + .getBoolean(R.string.switch_gesture_sides_key.toString(), false) + ) DisplayPortion.RIGHT_HALF + else DisplayPortion.LEFT_HALF if (isBrightnessGestureEnabled && isVolumeGestureEnabled) { if (getDisplayHalfPortion(initialEvent) === brightnessSide) { onScrollBrightness(distanceY) diff --git a/app/src/main/java/org/schabi/newpipe/settings/VideoAudioSettingsFragment.java b/app/src/main/java/org/schabi/newpipe/settings/VideoAudioSettingsFragment.java index 4936f979b..e1a8dd90b 100644 --- a/app/src/main/java/org/schabi/newpipe/settings/VideoAudioSettingsFragment.java +++ b/app/src/main/java/org/schabi/newpipe/settings/VideoAudioSettingsFragment.java @@ -6,12 +6,10 @@ import android.os.Build; import android.os.Bundle; import android.provider.Settings; import android.text.format.DateUtils; -import android.view.View; import android.widget.Toast; -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; import androidx.preference.ListPreference; +import androidx.preference.SwitchPreferenceCompat; import com.google.android.material.snackbar.Snackbar; @@ -24,31 +22,15 @@ import java.util.List; public class VideoAudioSettingsFragment extends BasePreferenceFragment { private SharedPreferences.OnSharedPreferenceChangeListener listener; - @Override - public void onViewCreated(@NonNull final View rootView, - @Nullable final Bundle savedInstanceState) { - super.onViewCreated(rootView, savedInstanceState); - findPreference(getString(R.string.switch_gesture_sides_key)) - .setEnabled(getPreferenceManager().getSharedPreferences() - .getBoolean(getString(R.string.volume_gesture_control_key), true) - && getPreferenceManager().getSharedPreferences() - .getBoolean(getString(R.string.brightness_gesture_control_key), true)); - } - @Override public void onCreatePreferences(final Bundle savedInstanceState, final String rootKey) { addPreferencesFromResourceRegistry(); updateSeekOptions(); + updateGestureSwitch(); listener = (sharedPreferences, key) -> { - findPreference(getString(R.string.switch_gesture_sides_key)) - .setEnabled(sharedPreferences.getBoolean( - getString(R.string.volume_gesture_control_key), true) - && sharedPreferences.getBoolean( - getString(R.string.brightness_gesture_control_key), true)); - // on M and above, if user chooses to minimise to popup player on exit // and the app doesn't have display over other apps permission, // show a snackbar to let the user give permission @@ -68,6 +50,9 @@ public class VideoAudioSettingsFragment extends BasePreferenceFragment { } } else if (getString(R.string.use_inexact_seek_key).equals(key)) { updateSeekOptions(); + } else if (getString(R.string.volume_gesture_control_key).equals(key) + || getString(R.string.brightness_gesture_control_key).equals(key)) { + updateGestureSwitch(); } }; } @@ -137,4 +122,19 @@ public class VideoAudioSettingsFragment extends BasePreferenceFragment { getPreferenceManager().getSharedPreferences() .unregisterOnSharedPreferenceChangeListener(listener); } + + private void updateGestureSwitch() { + final SwitchPreferenceCompat gestureSwitch = (SwitchPreferenceCompat) + findPreference(getString(R.string.switch_gesture_sides_key)); + if (getPreferenceManager().getSharedPreferences() + .getBoolean(getString(R.string.volume_gesture_control_key), true) + && getPreferenceManager().getSharedPreferences() + .getBoolean(getString(R.string.brightness_gesture_control_key), true)) { + gestureSwitch.setEnabled(true); + gestureSwitch.setSummary(getString(R.string.switch_gesture_sides_summary)); + } else { + gestureSwitch.setEnabled(false); + gestureSwitch.setSummary(getString(R.string.switch_gesture_sides_summary_disabled)); + } + } } diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 67acdcf0c..e1c5bc0bb 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -107,6 +107,7 @@ Use gestures to control player brightness Switch gesture sides Switches the sides of the volume and brightness gesture controls + Enable both brightness and volume gestures to use this feature Search suggestions Choose the suggestions to show when searching Local search suggestions From 759a9080a8af28b52f56eda187faca5bb69c15fd Mon Sep 17 00:00:00 2001 From: ge78fug Date: Mon, 23 Jan 2023 21:25:05 +0100 Subject: [PATCH 06/16] Fixed a bug --- .../newpipe/player/gesture/MainPlayerGestureListener.kt | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/org/schabi/newpipe/player/gesture/MainPlayerGestureListener.kt b/app/src/main/java/org/schabi/newpipe/player/gesture/MainPlayerGestureListener.kt index 960edbce2..74542af70 100644 --- a/app/src/main/java/org/schabi/newpipe/player/gesture/MainPlayerGestureListener.kt +++ b/app/src/main/java/org/schabi/newpipe/player/gesture/MainPlayerGestureListener.kt @@ -197,11 +197,12 @@ class MainPlayerGestureListener( val isBrightnessGestureEnabled = PlayerHelper.isBrightnessGestureEnabled(player.context) val isVolumeGestureEnabled = PlayerHelper.isVolumeGestureEnabled(player.context) val brightnessSide = if (PreferenceManager.getDefaultSharedPreferences(player.context) - .getBoolean(R.string.switch_gesture_sides_key.toString(), false) - ) DisplayPortion.RIGHT_HALF + .getBoolean( + player.context.getString(R.string.switch_gesture_sides_key), false)) + DisplayPortion.RIGHT_HALF else DisplayPortion.LEFT_HALF if (isBrightnessGestureEnabled && isVolumeGestureEnabled) { - if (getDisplayHalfPortion(initialEvent) === brightnessSide) { + if (getDisplayHalfPortion(initialEvent) == brightnessSide) { onScrollBrightness(distanceY) } else /* DisplayPortion.RIGHT_HALF */ { onScrollVolume(distanceY) From 2ded8c7cc18b7414d244e0e559acd3a1e9d7259f Mon Sep 17 00:00:00 2001 From: ge78fug Date: Sun, 29 Jan 2023 19:23:39 +0100 Subject: [PATCH 07/16] Made two list options --- .../fragments/detail/VideoDetailFragment.java | 5 ++- .../gesture/MainPlayerGestureListener.kt | 33 +++++++++-------- .../newpipe/player/helper/PlayerHelper.java | 10 +++--- .../settings/VideoAudioSettingsFragment.java | 20 ----------- app/src/main/res/values/settings_keys.xml | 35 +++++++++++++++++-- app/src/main/res/values/strings.xml | 14 ++++---- app/src/main/res/xml/video_audio_settings.xml | 32 ++++++++--------- 7 files changed, 79 insertions(+), 70 deletions(-) diff --git a/app/src/main/java/org/schabi/newpipe/fragments/detail/VideoDetailFragment.java b/app/src/main/java/org/schabi/newpipe/fragments/detail/VideoDetailFragment.java index 3d59ac6fe..885034e5a 100644 --- a/app/src/main/java/org/schabi/newpipe/fragments/detail/VideoDetailFragment.java +++ b/app/src/main/java/org/schabi/newpipe/fragments/detail/VideoDetailFragment.java @@ -2013,7 +2013,10 @@ public final class VideoDetailFragment restoreDefaultBrightness(); } else { // Do not restore if user has disabled brightness gesture - if (!PlayerHelper.isBrightnessGestureEnabled(activity)) { + if (!(PlayerHelper.getRightSideGesture(activity) + .equals(getString(R.string.right_brightness_control_key)) + && PlayerHelper.getLeftSideGesture(activity) + .equals(getString(R.string.left_brightness_control_key)))) { return; } // Restore already saved brightness level diff --git a/app/src/main/java/org/schabi/newpipe/player/gesture/MainPlayerGestureListener.kt b/app/src/main/java/org/schabi/newpipe/player/gesture/MainPlayerGestureListener.kt index 74542af70..82cf2244c 100644 --- a/app/src/main/java/org/schabi/newpipe/player/gesture/MainPlayerGestureListener.kt +++ b/app/src/main/java/org/schabi/newpipe/player/gesture/MainPlayerGestureListener.kt @@ -9,7 +9,6 @@ import androidx.appcompat.app.AppCompatActivity import androidx.appcompat.content.res.AppCompatResources import androidx.core.math.MathUtils import androidx.core.view.isVisible -import androidx.preference.PreferenceManager import org.schabi.newpipe.MainActivity import org.schabi.newpipe.R import org.schabi.newpipe.ktx.AnimationType @@ -194,23 +193,23 @@ class MainPlayerGestureListener( isMoving = true // -- Brightness and Volume control -- - val isBrightnessGestureEnabled = PlayerHelper.isBrightnessGestureEnabled(player.context) - val isVolumeGestureEnabled = PlayerHelper.isVolumeGestureEnabled(player.context) - val brightnessSide = if (PreferenceManager.getDefaultSharedPreferences(player.context) - .getBoolean( - player.context.getString(R.string.switch_gesture_sides_key), false)) - DisplayPortion.RIGHT_HALF - else DisplayPortion.LEFT_HALF - if (isBrightnessGestureEnabled && isVolumeGestureEnabled) { - if (getDisplayHalfPortion(initialEvent) == brightnessSide) { - onScrollBrightness(distanceY) - } else /* DisplayPortion.RIGHT_HALF */ { - onScrollVolume(distanceY) + val rightSide = PlayerHelper.getRightSideGesture(player.context) + val leftSide = PlayerHelper.getLeftSideGesture(player.context) + + if (getDisplayHalfPortion(initialEvent) == DisplayPortion.RIGHT_HALF) { + when (rightSide) { + player.context.getString(R.string.right_volume_control_key) -> + onScrollVolume(distanceY) + player.context.getString(R.string.right_brightness_control_key) -> + onScrollBrightness(distanceY) + } + } else { + when (leftSide) { + player.context.getString(R.string.left_volume_control_key) -> + onScrollVolume(distanceY) + player.context.getString(R.string.left_brightness_control_key) -> + onScrollBrightness(distanceY) } - } else if (isBrightnessGestureEnabled) { - onScrollBrightness(distanceY) - } else if (isVolumeGestureEnabled) { - onScrollVolume(distanceY) } return true diff --git a/app/src/main/java/org/schabi/newpipe/player/helper/PlayerHelper.java b/app/src/main/java/org/schabi/newpipe/player/helper/PlayerHelper.java index 1bc6f41a1..74bcf047c 100644 --- a/app/src/main/java/org/schabi/newpipe/player/helper/PlayerHelper.java +++ b/app/src/main/java/org/schabi/newpipe/player/helper/PlayerHelper.java @@ -228,14 +228,16 @@ public final class PlayerHelper { .getBoolean(context.getString(R.string.resume_on_audio_focus_gain_key), false); } - public static boolean isVolumeGestureEnabled(@NonNull final Context context) { + public static String getRightSideGesture(@NonNull final Context context) { return getPreferences(context) - .getBoolean(context.getString(R.string.volume_gesture_control_key), true); + .getString(context.getString(R.string.right_gesture_control_key), + context.getString(R.string.default_right_gesture_control_value)); } - public static boolean isBrightnessGestureEnabled(@NonNull final Context context) { + public static String getLeftSideGesture(@NonNull final Context context) { return getPreferences(context) - .getBoolean(context.getString(R.string.brightness_gesture_control_key), true); + .getString(context.getString(R.string.left_gesture_control_key), + context.getString(R.string.default_left_gesture_control_value)); } public static boolean isStartMainPlayerFullscreenEnabled(@NonNull final Context context) { diff --git a/app/src/main/java/org/schabi/newpipe/settings/VideoAudioSettingsFragment.java b/app/src/main/java/org/schabi/newpipe/settings/VideoAudioSettingsFragment.java index e1a8dd90b..aae9cfca5 100644 --- a/app/src/main/java/org/schabi/newpipe/settings/VideoAudioSettingsFragment.java +++ b/app/src/main/java/org/schabi/newpipe/settings/VideoAudioSettingsFragment.java @@ -9,7 +9,6 @@ import android.text.format.DateUtils; import android.widget.Toast; import androidx.preference.ListPreference; -import androidx.preference.SwitchPreferenceCompat; import com.google.android.material.snackbar.Snackbar; @@ -27,7 +26,6 @@ public class VideoAudioSettingsFragment extends BasePreferenceFragment { addPreferencesFromResourceRegistry(); updateSeekOptions(); - updateGestureSwitch(); listener = (sharedPreferences, key) -> { @@ -50,9 +48,6 @@ public class VideoAudioSettingsFragment extends BasePreferenceFragment { } } else if (getString(R.string.use_inexact_seek_key).equals(key)) { updateSeekOptions(); - } else if (getString(R.string.volume_gesture_control_key).equals(key) - || getString(R.string.brightness_gesture_control_key).equals(key)) { - updateGestureSwitch(); } }; } @@ -122,19 +117,4 @@ public class VideoAudioSettingsFragment extends BasePreferenceFragment { getPreferenceManager().getSharedPreferences() .unregisterOnSharedPreferenceChangeListener(listener); } - - private void updateGestureSwitch() { - final SwitchPreferenceCompat gestureSwitch = (SwitchPreferenceCompat) - findPreference(getString(R.string.switch_gesture_sides_key)); - if (getPreferenceManager().getSharedPreferences() - .getBoolean(getString(R.string.volume_gesture_control_key), true) - && getPreferenceManager().getSharedPreferences() - .getBoolean(getString(R.string.brightness_gesture_control_key), true)) { - gestureSwitch.setEnabled(true); - gestureSwitch.setSummary(getString(R.string.switch_gesture_sides_summary)); - } else { - gestureSwitch.setEnabled(false); - gestureSwitch.setSummary(getString(R.string.switch_gesture_sides_summary_disabled)); - } - } } diff --git a/app/src/main/res/values/settings_keys.xml b/app/src/main/res/values/settings_keys.xml index dae8cc113..ad6b1777b 100644 --- a/app/src/main/res/values/settings_keys.xml +++ b/app/src/main/res/values/settings_keys.xml @@ -16,9 +16,6 @@ use_external_video_player use_external_audio_player - volume_gesture_control - brightness_gesture_control - switch_gesture_sides resume_on_audio_focus_gain popup_remember_size_pos_key use_inexact_seek_key @@ -193,6 +190,38 @@ @string/audio_webm_key + left_gesture_control + @string/left_brightness_control_key + left_brightness_control + left_volume_control + left_none_control + + @string/brightness + @string/volume + @string/none + + + @string/left_brightness_control_key + @string/left_volume_control_key + @string/left_none_control_key + + + right_gesture_control + @string/right_volume_control_key + right_brightness_control + right_volume_control + right_none_control + + @string/volume + @string/brightness + @string/none + + + @string/right_volume_control_key + @string/right_brightness_control_key + @string/right_none_control_key + + last_resize_mode diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index e1c5bc0bb..6890e4dd0 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -101,13 +101,13 @@ Auto-enqueue next stream Continue ending (non-repeating) playback queue by appending a related stream Auto-enqueuing - Volume gesture control - Use gestures to control player volume - Brightness gesture control - Use gestures to control player brightness - Switch gesture sides - Switches the sides of the volume and brightness gesture controls - Enable both brightness and volume gestures to use this feature + Change the left gesture control + Left gesture control + Change the right gesture control + Right gesture control + Brightness + Volume + None Search suggestions Choose the suggestions to show when searching Local search suggestions diff --git a/app/src/main/res/xml/video_audio_settings.xml b/app/src/main/res/xml/video_audio_settings.xml index da932bb38..e4485f154 100644 --- a/app/src/main/res/xml/video_audio_settings.xml +++ b/app/src/main/res/xml/video_audio_settings.xml @@ -174,27 +174,23 @@ app:singleLineTitle="false" app:iconSpaceReserved="false" /> - - - - From 72ca52a29b403961c43ac3e53491b3c1641af159 Mon Sep 17 00:00:00 2001 From: Marius Wagner Date: Tue, 7 Feb 2023 17:10:18 +0000 Subject: [PATCH 08/16] Made the requested changes --- .../fragments/detail/VideoDetailFragment.java | 8 +++--- .../gesture/MainPlayerGestureListener.kt | 8 +++--- app/src/main/res/values/settings_keys.xml | 25 ++++++++----------- 3 files changed, 19 insertions(+), 22 deletions(-) diff --git a/app/src/main/java/org/schabi/newpipe/fragments/detail/VideoDetailFragment.java b/app/src/main/java/org/schabi/newpipe/fragments/detail/VideoDetailFragment.java index 885034e5a..e63e549a2 100644 --- a/app/src/main/java/org/schabi/newpipe/fragments/detail/VideoDetailFragment.java +++ b/app/src/main/java/org/schabi/newpipe/fragments/detail/VideoDetailFragment.java @@ -2013,10 +2013,10 @@ public final class VideoDetailFragment restoreDefaultBrightness(); } else { // Do not restore if user has disabled brightness gesture - if (!(PlayerHelper.getRightSideGesture(activity) - .equals(getString(R.string.right_brightness_control_key)) - && PlayerHelper.getLeftSideGesture(activity) - .equals(getString(R.string.left_brightness_control_key)))) { + if (PlayerHelper.getRightSideGesture(activity) + .equals(getString(R.string.brightness_control_key)) + || PlayerHelper.getLeftSideGesture(activity) + .equals(getString(R.string.brightness_control_key))) { return; } // Restore already saved brightness level diff --git a/app/src/main/java/org/schabi/newpipe/player/gesture/MainPlayerGestureListener.kt b/app/src/main/java/org/schabi/newpipe/player/gesture/MainPlayerGestureListener.kt index 82cf2244c..ce78fcfe2 100644 --- a/app/src/main/java/org/schabi/newpipe/player/gesture/MainPlayerGestureListener.kt +++ b/app/src/main/java/org/schabi/newpipe/player/gesture/MainPlayerGestureListener.kt @@ -198,16 +198,16 @@ class MainPlayerGestureListener( if (getDisplayHalfPortion(initialEvent) == DisplayPortion.RIGHT_HALF) { when (rightSide) { - player.context.getString(R.string.right_volume_control_key) -> + player.context.getString(R.string.volume_control_key) -> onScrollVolume(distanceY) - player.context.getString(R.string.right_brightness_control_key) -> + player.context.getString(R.string.brightness_control_key) -> onScrollBrightness(distanceY) } } else { when (leftSide) { - player.context.getString(R.string.left_volume_control_key) -> + player.context.getString(R.string.volume_control_key) -> onScrollVolume(distanceY) - player.context.getString(R.string.left_brightness_control_key) -> + player.context.getString(R.string.brightness_control_key) -> onScrollBrightness(distanceY) } } diff --git a/app/src/main/res/values/settings_keys.xml b/app/src/main/res/values/settings_keys.xml index ad6b1777b..8f3e8e192 100644 --- a/app/src/main/res/values/settings_keys.xml +++ b/app/src/main/res/values/settings_keys.xml @@ -191,35 +191,32 @@ left_gesture_control - @string/left_brightness_control_key - left_brightness_control - left_volume_control - left_none_control + @string/brightness_control_key + brightness_control + volume_control + none_control @string/brightness @string/volume @string/none - @string/left_brightness_control_key - @string/left_volume_control_key - @string/left_none_control_key + @string/brightness_control_key + @string/volume_control_key + @string/none_control_key right_gesture_control - @string/right_volume_control_key - right_brightness_control - right_volume_control - right_none_control + @string/volume_control_key @string/volume @string/brightness @string/none - @string/right_volume_control_key - @string/right_brightness_control_key - @string/right_none_control_key + @string/volume_control_key + @string/brightness_control_key + @string/none_control_key last_resize_mode From 32cec6c9a74efd65b58ebf504c646bb61a222961 Mon Sep 17 00:00:00 2001 From: ge78fug Date: Tue, 7 Feb 2023 19:08:47 +0100 Subject: [PATCH 09/16] Changed the naming --- .../newpipe/fragments/detail/VideoDetailFragment.java | 4 ++-- .../newpipe/player/gesture/MainPlayerGestureListener.kt | 7 ++----- .../org/schabi/newpipe/player/helper/PlayerHelper.java | 4 ++-- 3 files changed, 6 insertions(+), 9 deletions(-) diff --git a/app/src/main/java/org/schabi/newpipe/fragments/detail/VideoDetailFragment.java b/app/src/main/java/org/schabi/newpipe/fragments/detail/VideoDetailFragment.java index e63e549a2..7654e7689 100644 --- a/app/src/main/java/org/schabi/newpipe/fragments/detail/VideoDetailFragment.java +++ b/app/src/main/java/org/schabi/newpipe/fragments/detail/VideoDetailFragment.java @@ -2013,9 +2013,9 @@ public final class VideoDetailFragment restoreDefaultBrightness(); } else { // Do not restore if user has disabled brightness gesture - if (PlayerHelper.getRightSideGesture(activity) + if (PlayerHelper.getActionForRightGestureSide(activity) .equals(getString(R.string.brightness_control_key)) - || PlayerHelper.getLeftSideGesture(activity) + || PlayerHelper.getActionForLeftGestureSide(activity) .equals(getString(R.string.brightness_control_key))) { return; } diff --git a/app/src/main/java/org/schabi/newpipe/player/gesture/MainPlayerGestureListener.kt b/app/src/main/java/org/schabi/newpipe/player/gesture/MainPlayerGestureListener.kt index ce78fcfe2..0d28f2f58 100644 --- a/app/src/main/java/org/schabi/newpipe/player/gesture/MainPlayerGestureListener.kt +++ b/app/src/main/java/org/schabi/newpipe/player/gesture/MainPlayerGestureListener.kt @@ -193,18 +193,15 @@ class MainPlayerGestureListener( isMoving = true // -- Brightness and Volume control -- - val rightSide = PlayerHelper.getRightSideGesture(player.context) - val leftSide = PlayerHelper.getLeftSideGesture(player.context) - if (getDisplayHalfPortion(initialEvent) == DisplayPortion.RIGHT_HALF) { - when (rightSide) { + when (PlayerHelper.getActionForRightGestureSide(player.context)) { player.context.getString(R.string.volume_control_key) -> onScrollVolume(distanceY) player.context.getString(R.string.brightness_control_key) -> onScrollBrightness(distanceY) } } else { - when (leftSide) { + when (PlayerHelper.getActionForLeftGestureSide(player.context)) { player.context.getString(R.string.volume_control_key) -> onScrollVolume(distanceY) player.context.getString(R.string.brightness_control_key) -> diff --git a/app/src/main/java/org/schabi/newpipe/player/helper/PlayerHelper.java b/app/src/main/java/org/schabi/newpipe/player/helper/PlayerHelper.java index 74bcf047c..a110a80d6 100644 --- a/app/src/main/java/org/schabi/newpipe/player/helper/PlayerHelper.java +++ b/app/src/main/java/org/schabi/newpipe/player/helper/PlayerHelper.java @@ -228,13 +228,13 @@ public final class PlayerHelper { .getBoolean(context.getString(R.string.resume_on_audio_focus_gain_key), false); } - public static String getRightSideGesture(@NonNull final Context context) { + public static String getActionForRightGestureSide(@NonNull final Context context) { return getPreferences(context) .getString(context.getString(R.string.right_gesture_control_key), context.getString(R.string.default_right_gesture_control_value)); } - public static String getLeftSideGesture(@NonNull final Context context) { + public static String getActionForLeftGestureSide(@NonNull final Context context) { return getPreferences(context) .getString(context.getString(R.string.left_gesture_control_key), context.getString(R.string.default_left_gesture_control_value)); From 65d8589e7a40c1d2d5fdbf66a4096e4de7030c15 Mon Sep 17 00:00:00 2001 From: ge78fug Date: Fri, 10 Feb 2023 08:41:54 +0100 Subject: [PATCH 10/16] Changed the naming --- app/src/main/res/values/strings.xml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 6890e4dd0..43705056b 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -101,10 +101,10 @@ Auto-enqueue next stream Continue ending (non-repeating) playback queue by appending a related stream Auto-enqueuing - Change the left gesture control - Left gesture control - Change the right gesture control - Right gesture control + Choose gesture for left half of player screen + Left gesture action + Choose gesture for right half of player screen + Right gesture action Brightness Volume None From 7689d1d15cb26ef31193aef4cf0b02f59db13374 Mon Sep 17 00:00:00 2001 From: ge78fug Date: Wed, 1 Mar 2023 23:22:30 +0100 Subject: [PATCH 11/16] Added the migration --- .../newpipe/settings/SettingMigrations.java | 36 ++++++++++++++++++- 1 file changed, 35 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/org/schabi/newpipe/settings/SettingMigrations.java b/app/src/main/java/org/schabi/newpipe/settings/SettingMigrations.java index b1e2c04eb..21c0e1be4 100644 --- a/app/src/main/java/org/schabi/newpipe/settings/SettingMigrations.java +++ b/app/src/main/java/org/schabi/newpipe/settings/SettingMigrations.java @@ -108,6 +108,39 @@ public final class SettingMigrations { } }; + public static final Migration MIGRATION_4_5 = new Migration(4, 5) { + @Override + protected void migrate(final Context context) { + boolean brightnessGestureSwitch = sp.getBoolean( + context.getString(R.string.left_gesture_control_key), false); + boolean volumeGestureSwitch = sp.getBoolean( + context.getString(R.string.right_gesture_control_key), false); + + SharedPreferences.Editor editor = sp.edit(); + + if (volumeGestureSwitch) { + if (!brightnessGestureSwitch) { + editor.putString(context.getString(R.string.left_gesture_control_key), + context.getString(R.string.brightness)); + } + editor.putString(context.getString(R.string.right_gesture_control_key), + context.getString(R.string.volume)); + } else if (brightnessGestureSwitch) { + editor.putString(context.getString(R.string.right_gesture_control_key), + context.getString(R.string.brightness)); + editor.putString(context.getString(R.string.left_gesture_control_key), + context.getString(R.string.volume)); + } else { + editor.putString(context.getString(R.string.left_gesture_control_key), + context.getString(R.string.none)); + editor.putString(context.getString(R.string.right_gesture_control_key), + context.getString(R.string.none)); + } + + editor.apply(); + } + }; + /** * List of all implemented migrations. *

@@ -119,12 +152,13 @@ public final class SettingMigrations { MIGRATION_1_2, MIGRATION_2_3, MIGRATION_3_4, + MIGRATION_4_5, }; /** * Version number for preferences. Must be incremented every time a migration is necessary. */ - public static final int VERSION = 4; + public static final int VERSION = 5; public static void initMigrations(final Context context, final boolean isFirstRun) { From 3c72992c395fc1053c821ed8069bfedf40449ad3 Mon Sep 17 00:00:00 2001 From: Marius Wagner Date: Sun, 26 Feb 2023 17:00:06 +0100 Subject: [PATCH 12/16] Update app/src/main/java/org/schabi/newpipe/fragments/detail/VideoDetailFragment.java Co-authored-by: Stypox --- .../schabi/newpipe/fragments/detail/VideoDetailFragment.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/org/schabi/newpipe/fragments/detail/VideoDetailFragment.java b/app/src/main/java/org/schabi/newpipe/fragments/detail/VideoDetailFragment.java index 7654e7689..0950afc3e 100644 --- a/app/src/main/java/org/schabi/newpipe/fragments/detail/VideoDetailFragment.java +++ b/app/src/main/java/org/schabi/newpipe/fragments/detail/VideoDetailFragment.java @@ -2013,9 +2013,9 @@ public final class VideoDetailFragment restoreDefaultBrightness(); } else { // Do not restore if user has disabled brightness gesture - if (PlayerHelper.getActionForRightGestureSide(activity) + if (!PlayerHelper.getActionForRightGestureSide(activity) .equals(getString(R.string.brightness_control_key)) - || PlayerHelper.getActionForLeftGestureSide(activity) + && !PlayerHelper.getActionForLeftGestureSide(activity) .equals(getString(R.string.brightness_control_key))) { return; } From d2735607b84a5fbe442302ec9464161faed5daa1 Mon Sep 17 00:00:00 2001 From: ge78fug Date: Mon, 3 Apr 2023 23:11:40 +0200 Subject: [PATCH 13/16] Changed the default of the switches --- .../java/org/schabi/newpipe/settings/SettingMigrations.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/org/schabi/newpipe/settings/SettingMigrations.java b/app/src/main/java/org/schabi/newpipe/settings/SettingMigrations.java index 21c0e1be4..e2bb18b2d 100644 --- a/app/src/main/java/org/schabi/newpipe/settings/SettingMigrations.java +++ b/app/src/main/java/org/schabi/newpipe/settings/SettingMigrations.java @@ -112,9 +112,9 @@ public final class SettingMigrations { @Override protected void migrate(final Context context) { boolean brightnessGestureSwitch = sp.getBoolean( - context.getString(R.string.left_gesture_control_key), false); + context.getString(R.string.left_gesture_control_key), true); boolean volumeGestureSwitch = sp.getBoolean( - context.getString(R.string.right_gesture_control_key), false); + context.getString(R.string.right_gesture_control_key), true); SharedPreferences.Editor editor = sp.edit(); From 704e9bd7b6e4d58d10b0cce349cd3f8a13e46b85 Mon Sep 17 00:00:00 2001 From: Stypox Date: Tue, 4 Apr 2023 10:02:01 +0200 Subject: [PATCH 14/16] Fix checkstyle --- .../java/org/schabi/newpipe/settings/SettingMigrations.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/org/schabi/newpipe/settings/SettingMigrations.java b/app/src/main/java/org/schabi/newpipe/settings/SettingMigrations.java index e2bb18b2d..818d587d5 100644 --- a/app/src/main/java/org/schabi/newpipe/settings/SettingMigrations.java +++ b/app/src/main/java/org/schabi/newpipe/settings/SettingMigrations.java @@ -111,12 +111,12 @@ public final class SettingMigrations { public static final Migration MIGRATION_4_5 = new Migration(4, 5) { @Override protected void migrate(final Context context) { - boolean brightnessGestureSwitch = sp.getBoolean( + final boolean brightnessGestureSwitch = sp.getBoolean( context.getString(R.string.left_gesture_control_key), true); - boolean volumeGestureSwitch = sp.getBoolean( + final boolean volumeGestureSwitch = sp.getBoolean( context.getString(R.string.right_gesture_control_key), true); - SharedPreferences.Editor editor = sp.edit(); + final SharedPreferences.Editor editor = sp.edit(); if (volumeGestureSwitch) { if (!brightnessGestureSwitch) { From 7350b1f32ecd4d571d601036b46b84240658c1ab Mon Sep 17 00:00:00 2001 From: Stypox Date: Tue, 4 Apr 2023 10:38:13 +0200 Subject: [PATCH 15/16] Add notice to README to not open feature PRs --- .github/CONTRIBUTING.md | 2 ++ README.md | 2 ++ 2 files changed, 4 insertions(+) diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md index d5fdc97e0..088707b6e 100644 --- a/.github/CONTRIBUTING.md +++ b/.github/CONTRIBUTING.md @@ -1,3 +1,5 @@ +### Please do **not** open pull requests for *new features* now, as we are planning to rewrite large chunks of the code. Only bugfix PRs will be accepted. More details will be announced soon! + NewPipe contribution guidelines =============================== diff --git a/README.md b/README.md index 52e6eef1a..f184b5360 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,5 @@ +### Please do **not** open pull requests for *new features* now, as we are planning to rewrite large chunks of the code. Only bugfix PRs will be accepted. More details will be announced soon! +

NewPipe

A libre lightweight streaming front-end for Android.

From 4bb45c001de54d9734f7e3e1c7fbed75744b9c3e Mon Sep 17 00:00:00 2001 From: Stypox Date: Tue, 4 Apr 2023 10:27:43 +0200 Subject: [PATCH 16/16] Fix settings migration --- .../newpipe/settings/SettingMigrations.java | 30 +++++-------------- 1 file changed, 8 insertions(+), 22 deletions(-) diff --git a/app/src/main/java/org/schabi/newpipe/settings/SettingMigrations.java b/app/src/main/java/org/schabi/newpipe/settings/SettingMigrations.java index 818d587d5..1bfaec6c2 100644 --- a/app/src/main/java/org/schabi/newpipe/settings/SettingMigrations.java +++ b/app/src/main/java/org/schabi/newpipe/settings/SettingMigrations.java @@ -111,31 +111,17 @@ public final class SettingMigrations { public static final Migration MIGRATION_4_5 = new Migration(4, 5) { @Override protected void migrate(final Context context) { - final boolean brightnessGestureSwitch = sp.getBoolean( - context.getString(R.string.left_gesture_control_key), true); - final boolean volumeGestureSwitch = sp.getBoolean( - context.getString(R.string.right_gesture_control_key), true); + final boolean brightness = sp.getBoolean("brightness_gesture_control", true); + final boolean volume = sp.getBoolean("volume_gesture_control", true); final SharedPreferences.Editor editor = sp.edit(); - if (volumeGestureSwitch) { - if (!brightnessGestureSwitch) { - editor.putString(context.getString(R.string.left_gesture_control_key), - context.getString(R.string.brightness)); - } - editor.putString(context.getString(R.string.right_gesture_control_key), - context.getString(R.string.volume)); - } else if (brightnessGestureSwitch) { - editor.putString(context.getString(R.string.right_gesture_control_key), - context.getString(R.string.brightness)); - editor.putString(context.getString(R.string.left_gesture_control_key), - context.getString(R.string.volume)); - } else { - editor.putString(context.getString(R.string.left_gesture_control_key), - context.getString(R.string.none)); - editor.putString(context.getString(R.string.right_gesture_control_key), - context.getString(R.string.none)); - } + editor.putString(context.getString(R.string.right_gesture_control_key), + context.getString(volume + ? R.string.volume_control_key : R.string.none_control_key)); + editor.putString(context.getString(R.string.left_gesture_control_key), + context.getString(brightness + ? R.string.brightness_control_key : R.string.none_control_key)); editor.apply(); }