This commit is contained in:
Mauricio Colli 2017-07-09 22:38:47 -03:00
parent 7b60648424
commit 894ea27df2
5 changed files with 26 additions and 22 deletions

View File

@ -266,7 +266,7 @@ public class MainVideoPlayer extends Activity {
animateView(playerImpl.getControlsRoot(), true, 300, 0, new Runnable() { animateView(playerImpl.getControlsRoot(), true, 300, 0, new Runnable() {
@Override @Override
public void run() { public void run() {
if (getCurrentState() == STATE_PLAYING && !playerImpl.isQualityMenuVisible()) { if (getCurrentState() == STATE_PLAYING && !playerImpl.isSomePopupMenuVisible()) {
hideControls(300, DEFAULT_CONTROLS_HIDE_TIME); hideControls(300, DEFAULT_CONTROLS_HIDE_TIME);
} }
} }

View File

@ -109,7 +109,7 @@ public abstract class VideoPlayer extends BasePlayer implements SimpleExoPlayer.
private ValueAnimator controlViewAnimator; private ValueAnimator controlViewAnimator;
private Handler controlsVisibilityHandler = new Handler(); private Handler controlsVisibilityHandler = new Handler();
private boolean isQualityPopupMenuVisible = false; private boolean isSomePopupMenuVisible = false;
private boolean qualityChanged = false; private boolean qualityChanged = false;
private int qualityPopupMenuGroupId = 69; private int qualityPopupMenuGroupId = 69;
private PopupMenu qualityPopupMenu; private PopupMenu qualityPopupMenu;
@ -467,19 +467,19 @@ public abstract class VideoPlayer extends BasePlayer implements SimpleExoPlayer.
} }
/** /**
* Called when the quality selector is dismissed * Called when some popup menu is dismissed
*/ */
@Override @Override
public void onDismiss(PopupMenu menu) { public void onDismiss(PopupMenu menu) {
if (DEBUG) Log.d(TAG, "onDismiss() called with: menu = [" + menu + "]"); if (DEBUG) Log.d(TAG, "onDismiss() called with: menu = [" + menu + "]");
isQualityPopupMenuVisible = false; isSomePopupMenuVisible = false;
qualityTextView.setText(getSelectedVideoStream().resolution); qualityTextView.setText(getSelectedVideoStream().resolution);
} }
public void onQualitySelectorClicked() { public void onQualitySelectorClicked() {
if (DEBUG) Log.d(TAG, "onQualitySelectorClicked() called"); if (DEBUG) Log.d(TAG, "onQualitySelectorClicked() called");
qualityPopupMenu.show(); qualityPopupMenu.show();
isQualityPopupMenuVisible = true; isSomePopupMenuVisible = true;
showControls(300); showControls(300);
VideoStream videoStream = getSelectedVideoStream(); VideoStream videoStream = getSelectedVideoStream();
@ -490,6 +490,8 @@ public abstract class VideoPlayer extends BasePlayer implements SimpleExoPlayer.
private void onPlaybackSpeedClicked() { private void onPlaybackSpeedClicked() {
if (DEBUG) Log.d(TAG, "onPlaybackSpeedClicked() called"); if (DEBUG) Log.d(TAG, "onPlaybackSpeedClicked() called");
playbackSpeedPopupMenu.show(); playbackSpeedPopupMenu.show();
isSomePopupMenuVisible = true;
showControls(300);
} }
/*////////////////////////////////////////////////////////////////////////// /*//////////////////////////////////////////////////////////////////////////
@ -592,8 +594,8 @@ public abstract class VideoPlayer extends BasePlayer implements SimpleExoPlayer.
controlViewAnimator.start(); controlViewAnimator.start();
} }
public boolean isQualityMenuVisible() { public boolean isSomePopupMenuVisible() {
return isQualityPopupMenuVisible; return isSomePopupMenuVisible;
} }
public void showControlsThenHide() { public void showControlsThenHide() {

View File

@ -6,8 +6,8 @@
android:layout_height="match_parent" android:layout_height="match_parent"
android:background="@android:color/black" android:background="@android:color/black"
android:gravity="center" android:gravity="center"
tools:layout_width="@dimen/popup_default_width" tools:layout_height="84dp"
tools:layout_height="101.25dp"> tools:layout_width="@dimen/popup_minimum_width">
<com.google.android.exoplayer2.ui.AspectRatioFrameLayout <com.google.android.exoplayer2.ui.AspectRatioFrameLayout
@ -56,32 +56,34 @@
android:layout_alignParentTop="true" android:layout_alignParentTop="true"
android:background="@drawable/player_top_controls_bg" android:background="@drawable/player_top_controls_bg"
android:paddingBottom="20dp" android:paddingBottom="20dp"
android:paddingLeft="6dp" android:paddingLeft="2dp"
android:paddingRight="6dp" android:paddingRight="6dp"
android:paddingTop="4dp"> android:paddingTop="4dp"
tools:ignore="RtlHardcoded">
<TextView <TextView
android:id="@+id/qualityTextView" android:id="@+id/qualityTextView"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="30dp" android:layout_height="30dp"
android:layout_alignParentLeft="true" android:layout_alignParentLeft="true"
android:padding="5dp"
android:gravity="center" android:gravity="center"
android:text="720p" android:padding="5dp"
android:textColor="@android:color/white" android:textColor="@android:color/white"
android:textStyle="bold" android:textStyle="bold"
tools:ignore="HardcodedText,RtlHardcoded,RtlSymmetry"/> tools:ignore="RtlHardcoded,RtlSymmetry"
tools:text="1080p60"/>
<TextView <TextView
android:id="@+id/playbackSpeed" android:id="@+id/playbackSpeed"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="30dp" android:layout_height="30dp"
android:layout_toRightOf="@id/qualityTextView" android:layout_toRightOf="@+id/qualityTextView"
android:gravity="center" android:gravity="center"
android:padding="5dp" android:padding="6dp"
android:textColor="@android:color/white" android:textColor="@android:color/white"
tools:ignore="RtlHardcoded,RtlSymmetry" android:textStyle="bold"
tools:text="1x" /> tools:ignore="RelativeOverlap,RtlHardcoded,RtlSymmetry"
tools:text="1.75x"/>
<ImageButton <ImageButton
android:id="@+id/fullScreenButton" android:id="@+id/fullScreenButton"
@ -153,7 +155,7 @@
android:layout_height="match_parent" android:layout_height="match_parent"
android:gravity="center" android:gravity="center"
android:orientation="horizontal" android:orientation="horizontal"
android:weightSum="5"> android:weightSum="5.5">
<!--tools:visibility="gone">--> <!--tools:visibility="gone">-->
<ImageView <ImageView
@ -218,5 +220,5 @@
android:textStyle="bold" android:textStyle="bold"
android:visibility="gone" android:visibility="gone"
tools:ignore="RtlHardcoded" tools:ignore="RtlHardcoded"
tools:visibility="visible"/> tools:visibility="gone"/>
</FrameLayout> </FrameLayout>

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<resources> <resources>
<dimen name="popup_default_width">230dp</dimen> <dimen name="popup_default_width">230dp</dimen>
<dimen name="popup_minimum_width">140dp</dimen> <dimen name="popup_minimum_width">160dp</dimen>
<!-- Video Item Detail View Dimensions--> <!-- Video Item Detail View Dimensions-->
<!-- Text Size --> <!-- Text Size -->
<dimen name="channel_item_detail_title_text_size">18sp</dimen> <dimen name="channel_item_detail_title_text_size">18sp</dimen>

View File

@ -18,7 +18,7 @@
<dimen name="video_item_search_duration_margin">2sp</dimen> <dimen name="video_item_search_duration_margin">2sp</dimen>
<!-- Miscellaneous --> <!-- Miscellaneous -->
<dimen name="popup_default_width">180dp</dimen> <dimen name="popup_default_width">180dp</dimen>
<dimen name="popup_minimum_width">120dp</dimen> <dimen name="popup_minimum_width">150dp</dimen>
<!-- Video Item Detail View Dimensions--> <!-- Video Item Detail View Dimensions-->
<!-- Text Size --> <!-- Text Size -->
<dimen name="video_item_detail_title_text_size">16sp</dimen> <dimen name="video_item_detail_title_text_size">16sp</dimen>