Skip to content

Commit 413a1b5

Browse files
committed
Refactor constrolsTouchListener code
1 parent c7d392e commit 413a1b5

1 file changed

Lines changed: 6 additions & 8 deletions

File tree

app/src/main/java/org/schabi/newpipe/fragments/detail/VideoDetailFragment.java

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
import static org.schabi.newpipe.util.NavigationHelper.playWithKore;
1515

1616
import android.animation.ValueAnimator;
17+
import android.annotation.SuppressLint;
1718
import android.app.Activity;
1819
import android.content.BroadcastReceiver;
1920
import android.content.Context;
@@ -617,23 +618,20 @@ protected void initViews(final View rootView, final Bundle savedInstanceState) {
617618
}
618619

619620
@Override
621+
@SuppressLint("ClickableViewAccessibility")
620622
protected void initListeners() {
621623
super.initListeners();
622624

623625
setOnClickListeners();
624626
setOnLongClickListeners();
625627

626628
final View.OnTouchListener controlsTouchListener = (view, motionEvent) -> {
627-
if (!PreferenceManager.getDefaultSharedPreferences(activity)
629+
if (motionEvent.getAction() == MotionEvent.ACTION_DOWN
630+
&& PreferenceManager.getDefaultSharedPreferences(activity)
628631
.getBoolean(getString(R.string.show_hold_to_append_key), true)) {
629-
return false;
630-
}
631632

632-
if (motionEvent.getAction() == MotionEvent.ACTION_DOWN) {
633-
animate(binding.touchAppendDetail, true, 250, AnimationType.ALPHA,
634-
0, () ->
635-
animate(binding.touchAppendDetail, false, 1500,
636-
AnimationType.ALPHA, 1000));
633+
animate(binding.touchAppendDetail, true, 250, AnimationType.ALPHA, 0, () ->
634+
animate(binding.touchAppendDetail, false, 1500, AnimationType.ALPHA, 1000));
637635
}
638636
return false;
639637
};

0 commit comments

Comments
 (0)