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:
parent
c7d392e77e
commit
413a1b504a
@ -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;
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user