Release seekbar on any confirmation key, not just DPAD_CENTER
This commit is contained in:
parent
a1e02f7704
commit
c0fb96a911
|
@ -3,6 +3,7 @@ package org.schabi.newpipe.util;
|
|||
import android.annotation.SuppressLint;
|
||||
import android.content.pm.PackageManager;
|
||||
|
||||
import android.view.KeyEvent;
|
||||
import org.schabi.newpipe.App;
|
||||
|
||||
public class FireTvUtils {
|
||||
|
@ -15,4 +16,16 @@ public class FireTvUtils {
|
|||
return pm.hasSystemFeature(AMAZON_FEATURE_FIRE_TV)
|
||||
|| pm.hasSystemFeature(PackageManager.FEATURE_LEANBACK);
|
||||
}
|
||||
|
||||
public static boolean isConfirmKey(int keyCode) {
|
||||
switch (keyCode) {
|
||||
case KeyEvent.KEYCODE_DPAD_CENTER:
|
||||
case KeyEvent.KEYCODE_ENTER:
|
||||
case KeyEvent.KEYCODE_SPACE:
|
||||
case KeyEvent.KEYCODE_NUMPAD_ENTER:
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -25,6 +25,7 @@ import android.view.ViewTreeObserver;
|
|||
import android.widget.SeekBar;
|
||||
|
||||
import androidx.appcompat.widget.AppCompatSeekBar;
|
||||
import org.schabi.newpipe.util.FireTvUtils;
|
||||
|
||||
/**
|
||||
* SeekBar, adapted for directional navigation. It emulates touch-related callbacks
|
||||
|
@ -57,7 +58,7 @@ public final class FocusAwareSeekBar extends AppCompatSeekBar {
|
|||
|
||||
@Override
|
||||
public boolean onKeyDown(int keyCode, KeyEvent event) {
|
||||
if (!isInTouchMode() && keyCode == KeyEvent.KEYCODE_DPAD_CENTER) {
|
||||
if (!isInTouchMode() && FireTvUtils.isConfirmKey(keyCode)) {
|
||||
releaseTrack();
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue