1
0
mirror of https://github.com/TeamNewPipe/NewPipe synced 2024-12-23 08:30:44 +00:00

Small fixes of issues

This commit is contained in:
Avently 2020-07-13 23:28:39 +03:00
parent d2aaa6f691
commit bff238774e
5 changed files with 26 additions and 30 deletions

View File

@ -470,11 +470,6 @@ public class VideoDetailFragment
@Override @Override
public void onSaveInstanceState(final Bundle outState) { public void onSaveInstanceState(final Bundle outState) {
super.onSaveInstanceState(outState); super.onSaveInstanceState(outState);
// Check if the next video label and video is visible,
// if it is, include the two elements in the next check
int nextCount = currentInfo != null && currentInfo.getNextVideo() != null ? 2 : 0;
if (!isLoading.get() && currentInfo != null && isVisible()) { if (!isLoading.get() && currentInfo != null && isVisible()) {
outState.putSerializable(INFO_KEY, currentInfo); outState.putSerializable(INFO_KEY, currentInfo);
} }
@ -947,12 +942,12 @@ public class VideoDetailFragment
getString(R.string.show_age_restricted_content), false)) { getString(R.string.show_age_restricted_content), false)) {
hideAgeRestrictedContent(); hideAgeRestrictedContent();
} else { } else {
currentInfo = result;
handleResult(result); handleResult(result);
showContent(); showContent();
if (addToBackStack) { if (addToBackStack) {
if (playQueue == null) playQueue = new SinglePlayQueue(result); if (playQueue == null) playQueue = new SinglePlayQueue(result);
stack.push(new StackItem(serviceId, url, name, playQueue)); if (stack.isEmpty() || !stack.peek().getPlayQueue().equals(playQueue))
stack.push(new StackItem(serviceId, url, name, playQueue));
} }
if (isAutoplayEnabled()) openVideoPlayer(); if (isAutoplayEnabled()) openVideoPlayer();
} }

View File

@ -351,6 +351,7 @@ public class VideoPlayerImpl extends VideoPlayer
titleTextView.setVisibility(View.VISIBLE); titleTextView.setVisibility(View.VISIBLE);
channelTextView.setVisibility(View.VISIBLE); channelTextView.setVisibility(View.VISIBLE);
} }
setMuteButton(muteButton, isMuted());
animateRotation(moreOptionsButton, DEFAULT_CONTROLS_DURATION, 0); animateRotation(moreOptionsButton, DEFAULT_CONTROLS_DURATION, 0);
} }
@ -960,12 +961,12 @@ public class VideoPlayerImpl extends VideoPlayer
@Override @Override
public void onBlocked() { public void onBlocked() {
super.onBlocked(); super.onBlocked();
playPauseButton.setImageResource(R.drawable.exo_controls_play); playPauseButton.setImageResource(R.drawable.ic_play_arrow_white_24dp);
animatePlayButtons(false, 100); animatePlayButtons(false, 100);
getRootView().setKeepScreenOn(false); getRootView().setKeepScreenOn(false);
service.resetNotification(); service.resetNotification();
service.updateNotification(R.drawable.exo_controls_play); service.updateNotification(R.drawable.ic_play_arrow_white_24dp);
} }
@Override @Override
@ -974,14 +975,14 @@ public class VideoPlayerImpl extends VideoPlayer
getRootView().setKeepScreenOn(true); getRootView().setKeepScreenOn(true);
service.resetNotification(); service.resetNotification();
service.updateNotification(R.drawable.exo_controls_play); service.updateNotification(R.drawable.ic_play_arrow_white_24dp);
} }
@Override @Override
public void onPlaying() { public void onPlaying() {
super.onPlaying(); super.onPlaying();
animateView(playPauseButton, AnimationUtils.Type.SCALE_AND_ALPHA, false, 80, 0, () -> { animateView(playPauseButton, AnimationUtils.Type.SCALE_AND_ALPHA, false, 80, 0, () -> {
playPauseButton.setImageResource(R.drawable.exo_controls_pause); playPauseButton.setImageResource(R.drawable.ic_pause_white_24dp);
animatePlayButtons(true, 200); animatePlayButtons(true, 200);
playPauseButton.requestFocus(); playPauseButton.requestFocus();
}); });
@ -991,7 +992,7 @@ public class VideoPlayerImpl extends VideoPlayer
getRootView().setKeepScreenOn(true); getRootView().setKeepScreenOn(true);
service.resetNotification(); service.resetNotification();
service.updateNotification(R.drawable.exo_controls_pause); service.updateNotification(R.drawable.ic_pause_white_24dp);
service.startForeground(NOTIFICATION_ID, service.getNotBuilder().build()); service.startForeground(NOTIFICATION_ID, service.getNotBuilder().build());
} }
@ -1000,7 +1001,7 @@ public class VideoPlayerImpl extends VideoPlayer
public void onPaused() { public void onPaused() {
super.onPaused(); super.onPaused();
animateView(playPauseButton, AnimationUtils.Type.SCALE_AND_ALPHA, false, 80, 0, () -> { animateView(playPauseButton, AnimationUtils.Type.SCALE_AND_ALPHA, false, 80, 0, () -> {
playPauseButton.setImageResource(R.drawable.exo_controls_play); playPauseButton.setImageResource(R.drawable.ic_play_arrow_white_24dp);
animatePlayButtons(true, 200); animatePlayButtons(true, 200);
playPauseButton.requestFocus(); playPauseButton.requestFocus();
}); });
@ -1008,7 +1009,7 @@ public class VideoPlayerImpl extends VideoPlayer
updateWindowFlags(IDLE_WINDOW_FLAGS); updateWindowFlags(IDLE_WINDOW_FLAGS);
service.resetNotification(); service.resetNotification();
service.updateNotification(R.drawable.exo_controls_play); service.updateNotification(R.drawable.ic_play_arrow_white_24dp);
// Remove running notification when user don't want music (or video in popup) to be played in background // Remove running notification when user don't want music (or video in popup) to be played in background
if (!minimizeOnPopupEnabled() && !backgroundPlaybackEnabled() && videoPlayerSelected()) if (!minimizeOnPopupEnabled() && !backgroundPlaybackEnabled() && videoPlayerSelected())
@ -1024,7 +1025,7 @@ public class VideoPlayerImpl extends VideoPlayer
getRootView().setKeepScreenOn(true); getRootView().setKeepScreenOn(true);
service.resetNotification(); service.resetNotification();
service.updateNotification(R.drawable.exo_controls_play); service.updateNotification(R.drawable.ic_play_arrow_white_24dp);
} }

View File

@ -175,7 +175,11 @@ public class PlayerGestureListener extends GestureDetector.SimpleOnGestureListen
isMovingInMain = true; isMovingInMain = true;
if (isVolumeGestureEnabled && initialEvent.getX() > playerImpl.getRootView().getWidth() / 2.0) { boolean acceptAnyArea = isVolumeGestureEnabled != isBrightnessGestureEnabled;
boolean acceptVolumeArea = acceptAnyArea
|| initialEvent.getX() > playerImpl.getRootView().getWidth() / 2.0;
if (isVolumeGestureEnabled && acceptVolumeArea) {
playerImpl.getVolumeProgressBar().incrementProgressBy((int) distanceY); playerImpl.getVolumeProgressBar().incrementProgressBy((int) distanceY);
final float currentProgressPercent = final float currentProgressPercent =
(float) playerImpl.getVolumeProgressBar().getProgress() / playerImpl.getMaxGestureLength(); (float) playerImpl.getVolumeProgressBar().getProgress() / playerImpl.getMaxGestureLength();
@ -197,7 +201,7 @@ public class PlayerGestureListener extends GestureDetector.SimpleOnGestureListen
if (playerImpl.getBrightnessRelativeLayout().getVisibility() == View.VISIBLE) { if (playerImpl.getBrightnessRelativeLayout().getVisibility() == View.VISIBLE) {
playerImpl.getBrightnessRelativeLayout().setVisibility(View.GONE); playerImpl.getBrightnessRelativeLayout().setVisibility(View.GONE);
} }
} else if (isBrightnessGestureEnabled && initialEvent.getX() <= playerImpl.getRootView().getWidth() / 2.0) { } else {
final Activity parent = playerImpl.getParentActivity(); final Activity parent = playerImpl.getParentActivity();
if (parent == null) return true; if (parent == null) return true;

View File

@ -42,7 +42,6 @@
android:id="@+id/playQueuePanel" android:id="@+id/playQueuePanel"
android:layout_width="380dp" android:layout_width="380dp"
android:layout_alignParentEnd="true" android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:layout_height="match_parent" android:layout_height="match_parent"
android:visibility="gone" android:visibility="gone"
android:background="?attr/queue_background_color" android:background="?attr/queue_background_color"
@ -58,9 +57,7 @@
android:layout_width="50dp" android:layout_width="50dp"
android:layout_height="50dp" android:layout_height="50dp"
android:layout_centerVertical="true" android:layout_centerVertical="true"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true" android:layout_alignParentEnd="true"
android:layout_marginRight="40dp"
android:layout_marginEnd="40dp" android:layout_marginEnd="40dp"
android:padding="10dp" android:padding="10dp"
android:clickable="true" android:clickable="true"
@ -88,7 +85,6 @@
android:src="@drawable/exo_controls_repeat_off" android:src="@drawable/exo_controls_repeat_off"
android:background="?android:selectableItemBackground" android:background="?android:selectableItemBackground"
tools:ignore="ContentDescription,RtlHardcoded"/> tools:ignore="ContentDescription,RtlHardcoded"/>
<androidx.appcompat.widget.AppCompatImageButton <androidx.appcompat.widget.AppCompatImageButton
android:id="@+id/shuffleButton" android:id="@+id/shuffleButton"
android:layout_width="50dp" android:layout_width="50dp"
@ -150,7 +146,6 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_alignParentTop="true" android:layout_alignParentTop="true"
android:orientation="vertical" android:orientation="vertical"
android:minHeight="80dp"
android:gravity="top" android:gravity="top"
android:paddingTop="@dimen/player_main_top_padding" android:paddingTop="@dimen/player_main_top_padding"
android:paddingStart="@dimen/player_main_controls_padding" android:paddingStart="@dimen/player_main_controls_padding"
@ -161,7 +156,7 @@
android:id="@+id/primaryControls" android:id="@+id/primaryControls"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:minHeight="50dp" android:minHeight="45dp"
android:baselineAligned="false" android:baselineAligned="false"
android:gravity="top" android:gravity="top"
tools:ignore="RtlHardcoded"> tools:ignore="RtlHardcoded">
@ -223,9 +218,10 @@
<Button <Button
android:id="@+id/qualityTextView" android:id="@+id/qualityTextView"
style="@style/Widget.AppCompat.Button.Borderless" style="@style/Widget.AppCompat.Button.Borderless"
android:layout_width="wrap_content" android:layout_width="50dp"
android:layout_height="35dp" android:layout_height="35dp"
android:padding="@dimen/player_main_buttons_padding" android:paddingTop="@dimen/player_main_buttons_padding"
android:paddingBottom="@dimen/player_main_buttons_padding"
android:layout_marginEnd="8dp" android:layout_marginEnd="8dp"
android:gravity="center" android:gravity="center"
android:text="720p" android:text="720p"
@ -237,8 +233,8 @@
<Button <Button
android:id="@+id/playbackSpeed" android:id="@+id/playbackSpeed"
style="@style/Widget.AppCompat.Button.Borderless" style="@style/Widget.AppCompat.Button.Borderless"
android:layout_width="wrap_content" android:layout_width="45dp"
android:layout_height="wrap_content" android:layout_height="35dp"
android:padding="@dimen/player_main_buttons_padding" android:padding="@dimen/player_main_buttons_padding"
android:layout_marginEnd="8dp" android:layout_marginEnd="8dp"
android:gravity="center" android:gravity="center"
@ -251,7 +247,7 @@
<androidx.appcompat.widget.AppCompatImageButton <androidx.appcompat.widget.AppCompatImageButton
android:id="@+id/queueButton" android:id="@+id/queueButton"
android:layout_width="30dp" android:layout_width="45dp"
android:layout_height="35dp" android:layout_height="35dp"
android:padding="@dimen/player_main_buttons_padding" android:padding="@dimen/player_main_buttons_padding"
android:layout_marginEnd="8dp" android:layout_marginEnd="8dp"

View File

@ -146,7 +146,6 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_alignParentTop="true" android:layout_alignParentTop="true"
android:orientation="vertical" android:orientation="vertical"
android:minHeight="80dp"
android:gravity="top" android:gravity="top"
android:paddingTop="@dimen/player_main_top_padding" android:paddingTop="@dimen/player_main_top_padding"
android:paddingStart="@dimen/player_main_controls_padding" android:paddingStart="@dimen/player_main_controls_padding"
@ -157,7 +156,7 @@
android:id="@+id/primaryControls" android:id="@+id/primaryControls"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:minHeight="50dp" android:minHeight="45dp"
android:baselineAligned="false" android:baselineAligned="false"
android:gravity="top" android:gravity="top"
tools:ignore="RtlHardcoded"> tools:ignore="RtlHardcoded">
@ -307,6 +306,7 @@
android:layout_marginEnd="8dp" android:layout_marginEnd="8dp"
android:gravity="center|left" android:gravity="center|left"
android:minHeight="35dp" android:minHeight="35dp"
android:maxWidth="100dp"
android:lines="1" android:lines="1"
android:ellipsize="end" android:ellipsize="end"
android:minWidth="50dp" android:minWidth="50dp"