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() {
@Override
public void run() {
if (getCurrentState() == STATE_PLAYING && !playerImpl.isQualityMenuVisible()) {
if (getCurrentState() == STATE_PLAYING && !playerImpl.isSomePopupMenuVisible()) {
hideControls(300, DEFAULT_CONTROLS_HIDE_TIME);
}
}

View File

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

View File

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

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<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-->
<!-- Text Size -->
<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>
<!-- Miscellaneous -->
<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-->
<!-- Text Size -->
<dimen name="video_item_detail_title_text_size">16sp</dimen>