mirror of
https://github.com/TeamNewPipe/NewPipe
synced 2024-10-31 23:26:21 +00:00
Merge pull request #1969 from nv95/close_button
Show close button when playing completed
This commit is contained in:
commit
049cd2d236
@ -46,6 +46,7 @@ import android.view.GestureDetector;
|
|||||||
import android.view.MotionEvent;
|
import android.view.MotionEvent;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.WindowManager;
|
import android.view.WindowManager;
|
||||||
|
import android.widget.Button;
|
||||||
import android.widget.ImageButton;
|
import android.widget.ImageButton;
|
||||||
import android.widget.ImageView;
|
import android.widget.ImageView;
|
||||||
import android.widget.PopupMenu;
|
import android.widget.PopupMenu;
|
||||||
@ -394,6 +395,7 @@ public final class MainVideoPlayer extends AppCompatActivity
|
|||||||
private ImageButton playPauseButton;
|
private ImageButton playPauseButton;
|
||||||
private ImageButton playPreviousButton;
|
private ImageButton playPreviousButton;
|
||||||
private ImageButton playNextButton;
|
private ImageButton playNextButton;
|
||||||
|
private Button closeButton;
|
||||||
|
|
||||||
private RelativeLayout queueLayout;
|
private RelativeLayout queueLayout;
|
||||||
private ImageButton itemsListCloseButton;
|
private ImageButton itemsListCloseButton;
|
||||||
@ -435,6 +437,7 @@ public final class MainVideoPlayer extends AppCompatActivity
|
|||||||
this.playPauseButton = rootView.findViewById(R.id.playPauseButton);
|
this.playPauseButton = rootView.findViewById(R.id.playPauseButton);
|
||||||
this.playPreviousButton = rootView.findViewById(R.id.playPreviousButton);
|
this.playPreviousButton = rootView.findViewById(R.id.playPreviousButton);
|
||||||
this.playNextButton = rootView.findViewById(R.id.playNextButton);
|
this.playNextButton = rootView.findViewById(R.id.playNextButton);
|
||||||
|
this.closeButton = rootView.findViewById(R.id.closeButton);
|
||||||
|
|
||||||
this.moreOptionsButton = rootView.findViewById(R.id.moreOptionsButton);
|
this.moreOptionsButton = rootView.findViewById(R.id.moreOptionsButton);
|
||||||
this.secondaryControls = rootView.findViewById(R.id.secondaryControls);
|
this.secondaryControls = rootView.findViewById(R.id.secondaryControls);
|
||||||
@ -482,6 +485,7 @@ public final class MainVideoPlayer extends AppCompatActivity
|
|||||||
playPauseButton.setOnClickListener(this);
|
playPauseButton.setOnClickListener(this);
|
||||||
playPreviousButton.setOnClickListener(this);
|
playPreviousButton.setOnClickListener(this);
|
||||||
playNextButton.setOnClickListener(this);
|
playNextButton.setOnClickListener(this);
|
||||||
|
closeButton.setOnClickListener(this);
|
||||||
|
|
||||||
moreOptionsButton.setOnClickListener(this);
|
moreOptionsButton.setOnClickListener(this);
|
||||||
shareButton.setOnClickListener(this);
|
shareButton.setOnClickListener(this);
|
||||||
@ -647,6 +651,9 @@ public final class MainVideoPlayer extends AppCompatActivity
|
|||||||
} else if (v.getId() == switchBackgroundButton.getId()) {
|
} else if (v.getId() == switchBackgroundButton.getId()) {
|
||||||
onPlayBackgroundButtonClicked();
|
onPlayBackgroundButtonClicked();
|
||||||
|
|
||||||
|
} else if (v.getId() == closeButton.getId()) {
|
||||||
|
onPlaybackShutdown();
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (getCurrentState() != STATE_COMPLETED) {
|
if (getCurrentState() != STATE_COMPLETED) {
|
||||||
@ -780,6 +787,7 @@ public final class MainVideoPlayer extends AppCompatActivity
|
|||||||
super.onBlocked();
|
super.onBlocked();
|
||||||
playPauseButton.setImageResource(R.drawable.ic_pause_white);
|
playPauseButton.setImageResource(R.drawable.ic_pause_white);
|
||||||
animatePlayButtons(false, 100);
|
animatePlayButtons(false, 100);
|
||||||
|
animateView(closeButton, false, DEFAULT_CONTROLS_DURATION);
|
||||||
getRootView().setKeepScreenOn(true);
|
getRootView().setKeepScreenOn(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -795,6 +803,7 @@ public final class MainVideoPlayer extends AppCompatActivity
|
|||||||
animateView(playPauseButton, AnimationUtils.Type.SCALE_AND_ALPHA, false, 80, 0, () -> {
|
animateView(playPauseButton, AnimationUtils.Type.SCALE_AND_ALPHA, false, 80, 0, () -> {
|
||||||
playPauseButton.setImageResource(R.drawable.ic_pause_white);
|
playPauseButton.setImageResource(R.drawable.ic_pause_white);
|
||||||
animatePlayButtons(true, 200);
|
animatePlayButtons(true, 200);
|
||||||
|
animateView(closeButton, false, DEFAULT_CONTROLS_DURATION);
|
||||||
});
|
});
|
||||||
|
|
||||||
getRootView().setKeepScreenOn(true);
|
getRootView().setKeepScreenOn(true);
|
||||||
@ -806,6 +815,7 @@ public final class MainVideoPlayer extends AppCompatActivity
|
|||||||
animateView(playPauseButton, AnimationUtils.Type.SCALE_AND_ALPHA, false, 80, 0, () -> {
|
animateView(playPauseButton, AnimationUtils.Type.SCALE_AND_ALPHA, false, 80, 0, () -> {
|
||||||
playPauseButton.setImageResource(R.drawable.ic_play_arrow_white);
|
playPauseButton.setImageResource(R.drawable.ic_play_arrow_white);
|
||||||
animatePlayButtons(true, 200);
|
animatePlayButtons(true, 200);
|
||||||
|
animateView(closeButton, false, DEFAULT_CONTROLS_DURATION);
|
||||||
});
|
});
|
||||||
|
|
||||||
showSystemUi();
|
showSystemUi();
|
||||||
@ -825,8 +835,8 @@ public final class MainVideoPlayer extends AppCompatActivity
|
|||||||
animateView(playPauseButton, AnimationUtils.Type.SCALE_AND_ALPHA, false, 0, 0, () -> {
|
animateView(playPauseButton, AnimationUtils.Type.SCALE_AND_ALPHA, false, 0, 0, () -> {
|
||||||
playPauseButton.setImageResource(R.drawable.ic_replay_white);
|
playPauseButton.setImageResource(R.drawable.ic_replay_white);
|
||||||
animatePlayButtons(true, DEFAULT_CONTROLS_DURATION);
|
animatePlayButtons(true, DEFAULT_CONTROLS_DURATION);
|
||||||
|
animateView(closeButton, true, DEFAULT_CONTROLS_DURATION);
|
||||||
});
|
});
|
||||||
|
|
||||||
getRootView().setKeepScreenOn(false);
|
getRootView().setKeepScreenOn(false);
|
||||||
super.onCompleted();
|
super.onCompleted();
|
||||||
}
|
}
|
||||||
|
@ -477,6 +477,22 @@
|
|||||||
android:src="@drawable/exo_controls_next"
|
android:src="@drawable/exo_controls_next"
|
||||||
tools:ignore="ContentDescription"/>
|
tools:ignore="ContentDescription"/>
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:id="@+id/closeButton"
|
||||||
|
style="@style/Widget.AppCompat.Button.Borderless"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_below="@id/playPauseButton"
|
||||||
|
android:layout_centerInParent="true"
|
||||||
|
android:layout_marginTop="10dp"
|
||||||
|
android:background="?attr/selectableItemBackgroundBorderless"
|
||||||
|
android:clickable="true"
|
||||||
|
android:focusable="true"
|
||||||
|
android:text="@string/close"
|
||||||
|
android:textAllCaps="true"
|
||||||
|
android:textColor="@color/white"
|
||||||
|
android:visibility="invisible" />
|
||||||
|
|
||||||
</RelativeLayout>
|
</RelativeLayout>
|
||||||
|
|
||||||
|
|
||||||
|
@ -475,6 +475,22 @@
|
|||||||
android:src="@drawable/exo_controls_next"
|
android:src="@drawable/exo_controls_next"
|
||||||
tools:ignore="ContentDescription"/>
|
tools:ignore="ContentDescription"/>
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:id="@+id/closeButton"
|
||||||
|
style="@style/Widget.AppCompat.Button.Borderless"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_below="@id/playPauseButton"
|
||||||
|
android:layout_centerInParent="true"
|
||||||
|
android:layout_marginTop="10dp"
|
||||||
|
android:background="?attr/selectableItemBackgroundBorderless"
|
||||||
|
android:clickable="true"
|
||||||
|
android:focusable="true"
|
||||||
|
android:text="@string/close"
|
||||||
|
android:textAllCaps="true"
|
||||||
|
android:textColor="@color/white"
|
||||||
|
android:visibility="invisible" />
|
||||||
|
|
||||||
</RelativeLayout>
|
</RelativeLayout>
|
||||||
|
|
||||||
|
|
||||||
|
@ -471,4 +471,5 @@
|
|||||||
<string name="error_http_no_content">Не удалось получить данные с сервера</string>
|
<string name="error_http_no_content">Не удалось получить данные с сервера</string>
|
||||||
<string name="error_postprocessing_failed">Пост-обработка не удалась</string>
|
<string name="error_postprocessing_failed">Пост-обработка не удалась</string>
|
||||||
<string name="pause_downloads_on_mobile">Останавливать скачивание при переходе на мобильную сеть</string>
|
<string name="pause_downloads_on_mobile">Останавливать скачивание при переходе на мобильную сеть</string>
|
||||||
|
<string name="close">Закрыть</string>
|
||||||
</resources>
|
</resources>
|
@ -601,5 +601,6 @@
|
|||||||
<string name="max_retry_desc">Maximum number of attempts before canceling the download</string>
|
<string name="max_retry_desc">Maximum number of attempts before canceling the download</string>
|
||||||
<string name="pause_downloads_on_mobile">Pause on switching to mobile data</string>
|
<string name="pause_downloads_on_mobile">Pause on switching to mobile data</string>
|
||||||
<string name="pause_downloads_on_mobile_desc">Downloads that can not be paused will be restarted</string>
|
<string name="pause_downloads_on_mobile_desc">Downloads that can not be paused will be restarted</string>
|
||||||
|
<string name="close">Close</string>
|
||||||
|
|
||||||
</resources>
|
</resources>
|
Loading…
Reference in New Issue
Block a user