1
0
mirror of https://github.com/TeamNewPipe/NewPipe.git synced 2024-11-25 12:32:31 +01:00

Refactor constrolsTouchListener code

This commit is contained in:
Stypox 2022-12-31 17:47:57 +01:00
parent c7d392e77e
commit 413a1b504a
No known key found for this signature in database
GPG Key ID: 4BDF1B40A49FDD23

View File

@ -14,6 +14,7 @@ import static org.schabi.newpipe.util.NavigationHelper.openPlayQueue;
import static org.schabi.newpipe.util.NavigationHelper.playWithKore; import static org.schabi.newpipe.util.NavigationHelper.playWithKore;
import android.animation.ValueAnimator; import android.animation.ValueAnimator;
import android.annotation.SuppressLint;
import android.app.Activity; import android.app.Activity;
import android.content.BroadcastReceiver; import android.content.BroadcastReceiver;
import android.content.Context; import android.content.Context;
@ -617,6 +618,7 @@ public final class VideoDetailFragment
} }
@Override @Override
@SuppressLint("ClickableViewAccessibility")
protected void initListeners() { protected void initListeners() {
super.initListeners(); super.initListeners();
@ -624,16 +626,12 @@ public final class VideoDetailFragment
setOnLongClickListeners(); setOnLongClickListeners();
final View.OnTouchListener controlsTouchListener = (view, motionEvent) -> { final View.OnTouchListener controlsTouchListener = (view, motionEvent) -> {
if (!PreferenceManager.getDefaultSharedPreferences(activity) if (motionEvent.getAction() == MotionEvent.ACTION_DOWN
&& PreferenceManager.getDefaultSharedPreferences(activity)
.getBoolean(getString(R.string.show_hold_to_append_key), true)) { .getBoolean(getString(R.string.show_hold_to_append_key), true)) {
return false;
}
if (motionEvent.getAction() == MotionEvent.ACTION_DOWN) { animate(binding.touchAppendDetail, true, 250, AnimationType.ALPHA, 0, () ->
animate(binding.touchAppendDetail, true, 250, AnimationType.ALPHA, animate(binding.touchAppendDetail, false, 1500, AnimationType.ALPHA, 1000));
0, () ->
animate(binding.touchAppendDetail, false, 1500,
AnimationType.ALPHA, 1000));
} }
return false; return false;
}; };