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
public void onSaveInstanceState(final Bundle 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()) {
outState.putSerializable(INFO_KEY, currentInfo);
}
@ -947,12 +942,12 @@ public class VideoDetailFragment
getString(R.string.show_age_restricted_content), false)) {
hideAgeRestrictedContent();
} else {
currentInfo = result;
handleResult(result);
showContent();
if (addToBackStack) {
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();
}

View File

@ -351,6 +351,7 @@ public class VideoPlayerImpl extends VideoPlayer
titleTextView.setVisibility(View.VISIBLE);
channelTextView.setVisibility(View.VISIBLE);
}
setMuteButton(muteButton, isMuted());
animateRotation(moreOptionsButton, DEFAULT_CONTROLS_DURATION, 0);
}
@ -960,12 +961,12 @@ public class VideoPlayerImpl extends VideoPlayer
@Override
public void onBlocked() {
super.onBlocked();
playPauseButton.setImageResource(R.drawable.exo_controls_play);
playPauseButton.setImageResource(R.drawable.ic_play_arrow_white_24dp);
animatePlayButtons(false, 100);
getRootView().setKeepScreenOn(false);
service.resetNotification();
service.updateNotification(R.drawable.exo_controls_play);
service.updateNotification(R.drawable.ic_play_arrow_white_24dp);
}
@Override
@ -974,14 +975,14 @@ public class VideoPlayerImpl extends VideoPlayer
getRootView().setKeepScreenOn(true);
service.resetNotification();
service.updateNotification(R.drawable.exo_controls_play);
service.updateNotification(R.drawable.ic_play_arrow_white_24dp);
}
@Override
public void onPlaying() {
super.onPlaying();
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);
playPauseButton.requestFocus();
});
@ -991,7 +992,7 @@ public class VideoPlayerImpl extends VideoPlayer
getRootView().setKeepScreenOn(true);
service.resetNotification();
service.updateNotification(R.drawable.exo_controls_pause);
service.updateNotification(R.drawable.ic_pause_white_24dp);
service.startForeground(NOTIFICATION_ID, service.getNotBuilder().build());
}
@ -1000,7 +1001,7 @@ public class VideoPlayerImpl extends VideoPlayer
public void onPaused() {
super.onPaused();
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);
playPauseButton.requestFocus();
});
@ -1008,7 +1009,7 @@ public class VideoPlayerImpl extends VideoPlayer
updateWindowFlags(IDLE_WINDOW_FLAGS);
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
if (!minimizeOnPopupEnabled() && !backgroundPlaybackEnabled() && videoPlayerSelected())
@ -1024,7 +1025,7 @@ public class VideoPlayerImpl extends VideoPlayer
getRootView().setKeepScreenOn(true);
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;
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);
final float currentProgressPercent =
(float) playerImpl.getVolumeProgressBar().getProgress() / playerImpl.getMaxGestureLength();
@ -197,7 +201,7 @@ public class PlayerGestureListener extends GestureDetector.SimpleOnGestureListen
if (playerImpl.getBrightnessRelativeLayout().getVisibility() == View.VISIBLE) {
playerImpl.getBrightnessRelativeLayout().setVisibility(View.GONE);
}
} else if (isBrightnessGestureEnabled && initialEvent.getX() <= playerImpl.getRootView().getWidth() / 2.0) {
} else {
final Activity parent = playerImpl.getParentActivity();
if (parent == null) return true;

View File

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

View File

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