SeekOverlay: Switch to merge for SecondsView and other adjustments

This commit is contained in:
vkay94 2021-01-18 23:12:03 +01:00 committed by litetex
parent 72eb3b4415
commit 3aebfa22e9
6 changed files with 24 additions and 22 deletions

View File

@ -54,7 +54,7 @@ fun View.animate(
)
Log.d(TAG, "animate(): $msg")
}
if (isVisible && enterOrExit && alpha == 1f && animationType == AnimationType.ALPHA) {
if (isVisible && enterOrExit) {
if (MainActivity.DEBUG) {
Log.d(TAG, "animate(): view was already visible > view = [$this]")
}

View File

@ -251,6 +251,7 @@ public final class Player implements
public static final int DEFAULT_CONTROLS_DURATION = 300; // 300 millis
public static final int DEFAULT_CONTROLS_HIDE_TIME = 2000; // 2 Seconds
public static final int DPAD_CONTROLS_HIDE_TIME = 7000; // 7 Seconds
public static final int SEEK_OVERLAY_DURATION = 450; // 450 millis
/*//////////////////////////////////////////////////////////////////////////
// Other constants
@ -586,10 +587,9 @@ public final class Player implements
}
private void setupPlayerSeekOverlay() {
final int fadeDurations = 450;
binding.seekOverlay.showCircle(true)
.circleBackgroundColorInt(CircleClipTapView.COLOR_DARK_TRANSPARENT)
.seekSeconds(retrieveSeekDurationFromPreferences(this) / 1000)
.seekSeconds((int) (retrieveSeekDurationFromPreferences(this) / 1000.0f))
.performListener(new PlayerSeekOverlay.PerformListener() {
@Override
@ -605,22 +605,22 @@ public final class Player implements
@Override
public void onAnimationStart() {
animate(binding.seekOverlay, true, fadeDurations);
animate(binding.seekOverlay, true, SEEK_OVERLAY_DURATION);
animate(binding.playbackControlsShadow,
!simpleExoPlayer.getPlayWhenReady(), fadeDurations);
animate(binding.playerTopShadow, false, fadeDurations);
animate(binding.playerBottomShadow, false, fadeDurations);
animate(binding.playbackControlRoot, false, fadeDurations);
!simpleExoPlayer.getPlayWhenReady(), SEEK_OVERLAY_DURATION);
animate(binding.playerTopShadow, false, SEEK_OVERLAY_DURATION);
animate(binding.playerBottomShadow, false, SEEK_OVERLAY_DURATION);
animate(binding.playbackControlRoot, false, SEEK_OVERLAY_DURATION);
hideSystemUIIfNeeded();
}
@Override
public void onAnimationEnd() {
animate(binding.seekOverlay, false, fadeDurations);
animate(binding.seekOverlay, false, SEEK_OVERLAY_DURATION);
if (!simpleExoPlayer.getPlayWhenReady()) {
showControls(fadeDurations);
showControls(SEEK_OVERLAY_DURATION);
} else {
showHideShadow(false, fadeDurations);
showHideShadow(false, SEEK_OVERLAY_DURATION);
}
}

View File

@ -5,14 +5,13 @@ import android.animation.ValueAnimator
import android.content.Context
import android.util.AttributeSet
import android.view.LayoutInflater
import android.widget.LinearLayout
import android.widget.TextView
import androidx.annotation.DrawableRes
import androidx.constraintlayout.widget.ConstraintLayout
import kotlinx.android.synthetic.main.player_seek_seconds_view.view.*
import org.schabi.newpipe.R
class SecondsView(context: Context, attrs: AttributeSet?) :
ConstraintLayout(context, attrs) {
class SecondsView(context: Context, attrs: AttributeSet?) : LinearLayout(context, attrs) {
companion object {
const val ICON_ANIMATION_DURATION = 750L
@ -58,6 +57,8 @@ class SecondsView(context: Context, attrs: AttributeSet?) :
init {
LayoutInflater.from(context).inflate(R.layout.player_seek_seconds_view, this, true)
orientation = VERTICAL
layoutParams = LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT)
}
fun start() {

View File

@ -767,6 +767,6 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:visibility="invisible"
android:alpha="0" /> <!-- Required to make the first appearance fading correctly -->
android:alpha="0" /> <!-- Required for the first appearance fading correctly -->
</RelativeLayout>

View File

@ -764,6 +764,6 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:visibility="invisible"
android:alpha="0" /> <!-- Required to make the first appearance fading corectly -->
android:alpha="0" /> <!-- Required for the first appearance fading corectly -->
</RelativeLayout>

View File

@ -1,11 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
<merge xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
tools:ignore="ContentDescription">
tools:ignore="ContentDescription"
tools:layout_height="wrap_content"
tools:layout_width="match_parent"
tools:orientation="vertical"
tools:parentTag="android.widget.LinearLayout">
<LinearLayout
android:id="@+id/triangle_container"
@ -47,4 +48,4 @@
android:textSize="14sp"
tools:text="20 seconds" />
</LinearLayout>
</merge>