From 5931cd6af7439ed71c1978425df0001b35328d6a Mon Sep 17 00:00:00 2001 From: Ritiek Malhotra Date: Fri, 31 Aug 2018 19:30:40 +0530 Subject: [PATCH 1/3] Separate options for volume and brightness gestures --- .../schabi/newpipe/player/MainVideoPlayer.java | 13 +++++++++---- .../newpipe/player/helper/PlayerHelper.java | 16 ++++++++++++---- app/src/main/res/values/settings_keys.xml | 5 +++-- app/src/main/res/values/strings.xml | 6 ++++-- app/src/main/res/xml/video_audio_settings.xml | 12 +++++++++--- 5 files changed, 37 insertions(+), 15 deletions(-) diff --git a/app/src/main/java/org/schabi/newpipe/player/MainVideoPlayer.java b/app/src/main/java/org/schabi/newpipe/player/MainVideoPlayer.java index 41e7c305d..414c55e81 100644 --- a/app/src/main/java/org/schabi/newpipe/player/MainVideoPlayer.java +++ b/app/src/main/java/org/schabi/newpipe/player/MainVideoPlayer.java @@ -978,7 +978,8 @@ public final class MainVideoPlayer extends AppCompatActivity return super.onDown(e); } - private final boolean isPlayerGestureEnabled = PlayerHelper.isPlayerGestureEnabled(getApplicationContext()); + private final boolean isVolumeGestureEnabled = PlayerHelper.isVolumeGestureEnabled(getApplicationContext()); + private final boolean isBrightnessGestureEnabled = PlayerHelper.isBrightnessGestureEnabled(getApplicationContext()); private final int maxVolume = playerImpl.getAudioReactor().getMaxVolume(); @@ -986,7 +987,7 @@ public final class MainVideoPlayer extends AppCompatActivity @Override public boolean onScroll(MotionEvent e1, MotionEvent e2, float distanceX, float distanceY) { - if (!isPlayerGestureEnabled) return false; + if (!isVolumeGestureEnabled && !isBrightnessGestureEnabled) return false; //noinspection PointlessBooleanExpression if (DEBUG && false) Log.d(TAG, "MainVideoPlayer.onScroll = " + @@ -1002,7 +1003,11 @@ public final class MainVideoPlayer extends AppCompatActivity isMoving = true; - if (e1.getX() > playerImpl.getRootView().getWidth() / 2) { + boolean acceptAnyArea = isVolumeGestureEnabled != isBrightnessGestureEnabled; + boolean acceptVolumeArea = acceptAnyArea || e1.getX() > playerImpl.getRootView().getWidth() / 2; + boolean acceptBrightnessArea = acceptAnyArea || !acceptVolumeArea; + + if (isVolumeGestureEnabled && acceptVolumeArea) { playerImpl.getVolumeProgressBar().incrementProgressBy((int) distanceY); float currentProgressPercent = (float) playerImpl.getVolumeProgressBar().getProgress() / playerImpl.getMaxGestureLength(); @@ -1027,7 +1032,7 @@ public final class MainVideoPlayer extends AppCompatActivity if (playerImpl.getBrightnessRelativeLayout().getVisibility() == View.VISIBLE) { playerImpl.getBrightnessRelativeLayout().setVisibility(View.GONE); } - } else { + } else if (isBrightnessGestureEnabled && acceptBrightnessArea) { playerImpl.getBrightnessProgressBar().incrementProgressBy((int) distanceY); float currentProgressPercent = (float) playerImpl.getBrightnessProgressBar().getProgress() / playerImpl.getMaxGestureLength(); 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 ae187a834..52e268b24 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 @@ -169,8 +169,12 @@ public class PlayerHelper { return isResumeAfterAudioFocusGain(context, false); } - public static boolean isPlayerGestureEnabled(@NonNull final Context context) { - return isPlayerGestureEnabled(context, true); + public static boolean isVolumeGestureEnabled(@NonNull final Context context) { + return isVolumeGestureEnabled(context, true); + } + + public static boolean isBrightnessGestureEnabled(@NonNull final Context context) { + return isBrightnessGestureEnabled(context, true); } public static boolean isUsingOldPlayer(@NonNull final Context context) { @@ -306,8 +310,12 @@ public class PlayerHelper { return getPreferences(context).getBoolean(context.getString(R.string.resume_on_audio_focus_gain_key), b); } - private static boolean isPlayerGestureEnabled(@NonNull final Context context, final boolean b) { - return getPreferences(context).getBoolean(context.getString(R.string.player_gesture_controls_key), b); + private static boolean isVolumeGestureEnabled(@NonNull final Context context, final boolean b) { + return getPreferences(context).getBoolean(context.getString(R.string.volume_gesture_control_key), b); + } + + private static boolean isBrightnessGestureEnabled(@NonNull final Context context, final boolean b) { + return getPreferences(context).getBoolean(context.getString(R.string.brightness_gesture_control_key), b); } private static boolean isUsingOldPlayer(@NonNull final Context context, final boolean b) { diff --git a/app/src/main/res/values/settings_keys.xml b/app/src/main/res/values/settings_keys.xml index 02f065285..1a8158297 100644 --- a/app/src/main/res/values/settings_keys.xml +++ b/app/src/main/res/values/settings_keys.xml @@ -17,7 +17,8 @@ autoplay_through_intent use_oldplayer - player_gesture_controls + volume_gesture_control + brightness_gesture_control resume_on_audio_focus_gain popup_remember_size_pos_key use_inexact_seek_key @@ -892,4 +893,4 @@ - \ No newline at end of file + diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index eaeeb2685..ddb889a64 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -82,8 +82,10 @@ Metadata cache wiped Auto-queue next stream Auto-append a related stream when playing the last stream in a non-repeating queue. - Player gesture controls - Use gestures to control the brightness and volume of the player + Volume gesture control + Use gestures to control the volume of the player + Brightness gesture control + Use gestures to control the brightness of the player Search suggestions Show suggestions when searching Search history diff --git a/app/src/main/res/xml/video_audio_settings.xml b/app/src/main/res/xml/video_audio_settings.xml index a547ffaf2..5ac5bb733 100644 --- a/app/src/main/res/xml/video_audio_settings.xml +++ b/app/src/main/res/xml/video_audio_settings.xml @@ -106,9 +106,15 @@ + android:key="@string/volume_gesture_control_key" + android:summary="@string/volume_gesture_control_summary" + android:title="@string/volume_gesture_control_title"/> + + Date: Sat, 8 Sep 2018 23:13:04 +0530 Subject: [PATCH 2/3] We don't need to check this --- app/src/main/java/org/schabi/newpipe/player/MainVideoPlayer.java | 1 - 1 file changed, 1 deletion(-) diff --git a/app/src/main/java/org/schabi/newpipe/player/MainVideoPlayer.java b/app/src/main/java/org/schabi/newpipe/player/MainVideoPlayer.java index 7ca790d92..de7960a0d 100644 --- a/app/src/main/java/org/schabi/newpipe/player/MainVideoPlayer.java +++ b/app/src/main/java/org/schabi/newpipe/player/MainVideoPlayer.java @@ -992,7 +992,6 @@ public final class MainVideoPlayer extends AppCompatActivity private final boolean isVolumeGestureEnabled = PlayerHelper.isVolumeGestureEnabled(getApplicationContext()); private final boolean isBrightnessGestureEnabled = PlayerHelper.isBrightnessGestureEnabled(getApplicationContext()); - private final boolean isPlayerGestureEnabled = PlayerHelper.isPlayerGestureEnabled(getApplicationContext()); private final int maxVolume = playerImpl.getAudioReactor().getMaxVolume(); @Override From c371d863d999dd445ed82c4786705f9634f793d2 Mon Sep 17 00:00:00 2001 From: SadError256 <43082574+saderror256@users.noreply.github.com> Date: Sat, 13 Oct 2018 18:20:47 -0400 Subject: [PATCH 3/3] Fix broken bold also removed useless backslash in html5 --- README.md | 39 ++++++++++++++++++++------------------- 1 file changed, 20 insertions(+), 19 deletions(-) diff --git a/README.md b/README.md index a171823d5..3b1a4fdcf 100644 --- a/README.md +++ b/README.md @@ -1,21 +1,22 @@ -

+

NewPipe

A free lightweight YouTube frontend for Android.

-

+

- - - - - - + + + + + +

-
+

ScreenshotsDescriptionFeaturesContributionDonateLicense

WebsiteBlogPress

-
-**WARNING: PUTTING NEWPIPE OR ANY FORK OF IT INTO GOOGLE PLAYSTORE VIOLATES THEIR TERMS OF CONDITIONS.** +
+ +WARNING: PUTTING NEWPIPE OR ANY FORK OF IT INTO GOOGLE PLAYSTORE VIOLATES THEIR TERMS OF CONDITIONS. ## Screenshots @@ -83,19 +84,19 @@ If you like NewPipe we'd be happy about a donation. You can either donate via Bi - - + + - - - + + + - - - + + +
BitcoinBitcoin QR CodeBitcoinBitcoin QR Code 16A9J59ahMRqkLSZjhYj33n9j3fMztFxnh
LiberapayVisit NewPipe at liberapay.comDonate via LiberapayLiberapayVisit NewPipe at liberapay.comDonate via Liberapay
BountysourceVisit NewPipe at bountysource.comCheck out how many bounties you can earn.BountysourceVisit NewPipe at bountysource.comCheck out how many bounties you can earn.