Merge remote-tracking branch 'origin/dev' into dev
This commit is contained in:
commit
fcb67f5119
|
@ -44,6 +44,7 @@ import android.view.MotionEvent;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.WindowManager;
|
import android.view.WindowManager;
|
||||||
import android.widget.ImageButton;
|
import android.widget.ImageButton;
|
||||||
|
import android.widget.ImageView;
|
||||||
import android.widget.PopupMenu;
|
import android.widget.PopupMenu;
|
||||||
import android.widget.RemoteViews;
|
import android.widget.RemoteViews;
|
||||||
import android.widget.SeekBar;
|
import android.widget.SeekBar;
|
||||||
|
@ -370,6 +371,7 @@ public final class PopupVideoPlayer extends Service {
|
||||||
protected class VideoPlayerImpl extends VideoPlayer implements View.OnLayoutChangeListener {
|
protected class VideoPlayerImpl extends VideoPlayer implements View.OnLayoutChangeListener {
|
||||||
private TextView resizingIndicator;
|
private TextView resizingIndicator;
|
||||||
private ImageButton fullScreenButton;
|
private ImageButton fullScreenButton;
|
||||||
|
private ImageView videoPlayPause;
|
||||||
|
|
||||||
private View extraOptionsView;
|
private View extraOptionsView;
|
||||||
|
|
||||||
|
@ -391,6 +393,8 @@ public final class PopupVideoPlayer extends Service {
|
||||||
resizingIndicator = rootView.findViewById(R.id.resizing_indicator);
|
resizingIndicator = rootView.findViewById(R.id.resizing_indicator);
|
||||||
fullScreenButton = rootView.findViewById(R.id.fullScreenButton);
|
fullScreenButton = rootView.findViewById(R.id.fullScreenButton);
|
||||||
fullScreenButton.setOnClickListener(v -> onFullScreenButtonClicked());
|
fullScreenButton.setOnClickListener(v -> onFullScreenButtonClicked());
|
||||||
|
videoPlayPause = rootView.findViewById(R.id.videoPlayPause);
|
||||||
|
videoPlayPause.setOnClickListener(this::onPlayPauseButtonPressed);
|
||||||
|
|
||||||
extraOptionsView = rootView.findViewById(R.id.extraOptionsView);
|
extraOptionsView = rootView.findViewById(R.id.extraOptionsView);
|
||||||
rootView.addOnLayoutChangeListener(this);
|
rootView.addOnLayoutChangeListener(this);
|
||||||
|
@ -406,6 +410,10 @@ public final class PopupVideoPlayer extends Service {
|
||||||
view.setStyle(captionStyle);
|
view.setStyle(captionStyle);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void onPlayPauseButtonPressed(View ib) {
|
||||||
|
onPlayPause();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onLayoutChange(final View view, int left, int top, int right, int bottom,
|
public void onLayoutChange(final View view, int left, int top, int right, int bottom,
|
||||||
int oldLeft, int oldTop, int oldRight, int oldBottom) {
|
int oldLeft, int oldTop, int oldRight, int oldBottom) {
|
||||||
|
@ -651,6 +659,7 @@ public final class PopupVideoPlayer extends Service {
|
||||||
public void onPlaying() {
|
public void onPlaying() {
|
||||||
super.onPlaying();
|
super.onPlaying();
|
||||||
updateNotification(R.drawable.ic_pause_white);
|
updateNotification(R.drawable.ic_pause_white);
|
||||||
|
videoPlayPause.setBackgroundResource(R.drawable.ic_pause_white);
|
||||||
lockManager.acquireWifiAndCpu();
|
lockManager.acquireWifiAndCpu();
|
||||||
|
|
||||||
hideControls(DEFAULT_CONTROLS_DURATION, DEFAULT_CONTROLS_HIDE_TIME);
|
hideControls(DEFAULT_CONTROLS_DURATION, DEFAULT_CONTROLS_HIDE_TIME);
|
||||||
|
@ -666,13 +675,14 @@ public final class PopupVideoPlayer extends Service {
|
||||||
public void onPaused() {
|
public void onPaused() {
|
||||||
super.onPaused();
|
super.onPaused();
|
||||||
updateNotification(R.drawable.ic_play_arrow_white);
|
updateNotification(R.drawable.ic_play_arrow_white);
|
||||||
showAndAnimateControl(R.drawable.ic_play_arrow_white, false);
|
videoPlayPause.setBackgroundResource(R.drawable.ic_play_arrow_white);
|
||||||
lockManager.releaseWifiAndCpu();
|
lockManager.releaseWifiAndCpu();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onPausedSeek() {
|
public void onPausedSeek() {
|
||||||
super.onPausedSeek();
|
super.onPausedSeek();
|
||||||
|
videoPlayPause.setBackgroundResource(R.drawable.ic_pause_white);
|
||||||
updateNotification(R.drawable.ic_play_arrow_white);
|
updateNotification(R.drawable.ic_play_arrow_white);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -680,10 +690,27 @@ public final class PopupVideoPlayer extends Service {
|
||||||
public void onCompleted() {
|
public void onCompleted() {
|
||||||
super.onCompleted();
|
super.onCompleted();
|
||||||
updateNotification(R.drawable.ic_replay_white);
|
updateNotification(R.drawable.ic_replay_white);
|
||||||
showAndAnimateControl(R.drawable.ic_replay_white, false);
|
videoPlayPause.setBackgroundResource(R.drawable.ic_replay_white);
|
||||||
lockManager.releaseWifiAndCpu();
|
lockManager.releaseWifiAndCpu();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void showControlsThenHide() {
|
||||||
|
videoPlayPause.setVisibility(View.VISIBLE);
|
||||||
|
super.showControlsThenHide();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void showControls(long duration) {
|
||||||
|
videoPlayPause.setVisibility(View.VISIBLE);
|
||||||
|
super.showControls(duration);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void hideControls(final long duration, long delay) {
|
||||||
|
super.hideControlsAndButton(duration, delay, videoPlayPause);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*//////////////////////////////////////////////////////////////////////////
|
/*//////////////////////////////////////////////////////////////////////////
|
||||||
// Utils
|
// Utils
|
||||||
//////////////////////////////////////////////////////////////////////////*/
|
//////////////////////////////////////////////////////////////////////////*/
|
||||||
|
@ -717,6 +744,8 @@ public final class PopupVideoPlayer extends Service {
|
||||||
Log.d(TAG, "onDoubleTap() called with: e = [" + e + "]" + "rawXy = " + e.getRawX() + ", " + e.getRawY() + ", xy = " + e.getX() + ", " + e.getY());
|
Log.d(TAG, "onDoubleTap() called with: e = [" + e + "]" + "rawXy = " + e.getRawX() + ", " + e.getRawY() + ", xy = " + e.getX() + ", " + e.getY());
|
||||||
if (playerImpl == null || !playerImpl.isPlaying()) return false;
|
if (playerImpl == null || !playerImpl.isPlaying()) return false;
|
||||||
|
|
||||||
|
playerImpl.hideControls(0, 0);
|
||||||
|
|
||||||
if (e.getX() > popupWidth / 2) {
|
if (e.getX() > popupWidth / 2) {
|
||||||
playerImpl.onFastForward();
|
playerImpl.onFastForward();
|
||||||
} else {
|
} else {
|
||||||
|
@ -730,7 +759,12 @@ public final class PopupVideoPlayer extends Service {
|
||||||
public boolean onSingleTapConfirmed(MotionEvent e) {
|
public boolean onSingleTapConfirmed(MotionEvent e) {
|
||||||
if (DEBUG) Log.d(TAG, "onSingleTapConfirmed() called with: e = [" + e + "]");
|
if (DEBUG) Log.d(TAG, "onSingleTapConfirmed() called with: e = [" + e + "]");
|
||||||
if (playerImpl == null || playerImpl.getPlayer() == null) return false;
|
if (playerImpl == null || playerImpl.getPlayer() == null) return false;
|
||||||
playerImpl.onPlayPause();
|
if (playerImpl.isControlsVisible()) {
|
||||||
|
playerImpl.hideControls(100, 100);
|
||||||
|
} else {
|
||||||
|
playerImpl.showControlsThenHide();
|
||||||
|
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -887,6 +887,19 @@ public abstract class VideoPlayer extends BasePlayer
|
||||||
() -> animateView(controlsRoot, false, duration), delay);
|
() -> animateView(controlsRoot, false, duration), delay);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void hideControlsAndButton(final long duration, long delay, View button) {
|
||||||
|
if (DEBUG) Log.d(TAG, "hideControls() called with: delay = [" + delay + "]");
|
||||||
|
controlsVisibilityHandler.removeCallbacksAndMessages(null);
|
||||||
|
controlsVisibilityHandler.postDelayed(hideControlsAndButtonHandler(duration, button), delay);
|
||||||
|
}
|
||||||
|
|
||||||
|
private Runnable hideControlsAndButtonHandler(long duration, View videoPlayPause)
|
||||||
|
{
|
||||||
|
return () -> {
|
||||||
|
videoPlayPause.setVisibility(View.INVISIBLE);
|
||||||
|
animateView(controlsRoot, false,duration);
|
||||||
|
};
|
||||||
|
}
|
||||||
/*//////////////////////////////////////////////////////////////////////////
|
/*//////////////////////////////////////////////////////////////////////////
|
||||||
// Getters and Setters
|
// Getters and Setters
|
||||||
//////////////////////////////////////////////////////////////////////////*/
|
//////////////////////////////////////////////////////////////////////////*/
|
||||||
|
|
|
@ -53,6 +53,16 @@
|
||||||
android:visibility="gone"
|
android:visibility="gone"
|
||||||
tools:visibility="visible">
|
tools:visibility="visible">
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/videoPlayPause"
|
||||||
|
android:layout_width="55dp"
|
||||||
|
android:layout_height="55dp"
|
||||||
|
android:layout_centerHorizontal="false"
|
||||||
|
android:layout_centerInParent="true"
|
||||||
|
android:visibility="gone"
|
||||||
|
tools:ignore="ContentDescription"
|
||||||
|
tools:visibility="visible" />
|
||||||
|
|
||||||
<RelativeLayout
|
<RelativeLayout
|
||||||
android:id="@+id/topControls"
|
android:id="@+id/topControls"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
|
@ -101,15 +111,15 @@
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/resizeTextView"
|
android:id="@+id/resizeTextView"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:padding="5dp"
|
|
||||||
android:layout_alignParentLeft="true"
|
android:layout_alignParentLeft="true"
|
||||||
|
android:background="?attr/selectableItemBackground"
|
||||||
android:gravity="center"
|
android:gravity="center"
|
||||||
android:minWidth="50dp"
|
android:minWidth="50dp"
|
||||||
|
android:padding="5dp"
|
||||||
android:textColor="@android:color/white"
|
android:textColor="@android:color/white"
|
||||||
android:textStyle="bold"
|
android:textStyle="bold"
|
||||||
android:background="?attr/selectableItemBackground"
|
|
||||||
tools:ignore="HardcodedText,RtlHardcoded"
|
tools:ignore="HardcodedText,RtlHardcoded"
|
||||||
tools:text="FIT" />
|
tools:text="FIT" />
|
||||||
|
|
||||||
|
@ -133,12 +143,13 @@
|
||||||
android:layout_width="30dp"
|
android:layout_width="30dp"
|
||||||
android:layout_height="30dp"
|
android:layout_height="30dp"
|
||||||
android:layout_alignParentRight="true"
|
android:layout_alignParentRight="true"
|
||||||
|
android:background="?attr/selectableItemBackground"
|
||||||
android:clickable="true"
|
android:clickable="true"
|
||||||
android:focusable="true"
|
android:focusable="true"
|
||||||
android:scaleType="fitCenter"
|
android:scaleType="fitCenter"
|
||||||
android:background="?attr/selectableItemBackground"
|
|
||||||
android:src="@drawable/ic_fullscreen_white"
|
android:src="@drawable/ic_fullscreen_white"
|
||||||
tools:ignore="ContentDescription,RtlHardcoded" />
|
tools:ignore="ContentDescription,RtlHardcoded" />
|
||||||
|
|
||||||
</RelativeLayout>
|
</RelativeLayout>
|
||||||
|
|
||||||
<!--Shadow Bottom Control-->
|
<!--Shadow Bottom Control-->
|
||||||
|
|
Loading…
Reference in New Issue