Player gestures: Fix respecting brightness-volume-gesture settings
This commit is contained in:
parent
66d15ea635
commit
b5321152fd
|
@ -36,15 +36,10 @@ public class PlayerGestureListener
|
|||
private static final String TAG = ".PlayerGestureListener";
|
||||
private static final boolean DEBUG = BasePlayer.DEBUG;
|
||||
|
||||
private final boolean isVolumeGestureEnabled;
|
||||
private final boolean isBrightnessGestureEnabled;
|
||||
private final int maxVolume;
|
||||
|
||||
public PlayerGestureListener(final VideoPlayerImpl playerImpl, final MainPlayer service) {
|
||||
super(playerImpl, service);
|
||||
|
||||
isVolumeGestureEnabled = PlayerHelper.isVolumeGestureEnabled(service);
|
||||
isBrightnessGestureEnabled = PlayerHelper.isBrightnessGestureEnabled(service);
|
||||
maxVolume = playerImpl.getAudioReactor().getMaxVolume();
|
||||
}
|
||||
|
||||
|
@ -110,12 +105,22 @@ public class PlayerGestureListener
|
|||
+ portion + "]");
|
||||
}
|
||||
if (playerType == MainPlayer.PlayerType.VIDEO) {
|
||||
final boolean isBrightnessGestureEnabled =
|
||||
PlayerHelper.isBrightnessGestureEnabled(service);
|
||||
final boolean isVolumeGestureEnabled = PlayerHelper.isVolumeGestureEnabled(service);
|
||||
|
||||
if (isBrightnessGestureEnabled && isVolumeGestureEnabled) {
|
||||
if (portion == DisplayPortion.LEFT_HALF) {
|
||||
onScrollMainBrightness(distanceX, distanceY);
|
||||
|
||||
} else /* DisplayPortion.RIGHT_HALF */ {
|
||||
onScrollMainVolume(distanceX, distanceY);
|
||||
}
|
||||
} else if (isBrightnessGestureEnabled) {
|
||||
onScrollMainBrightness(distanceX, distanceY);
|
||||
} else if (isVolumeGestureEnabled) {
|
||||
onScrollMainVolume(distanceX, distanceY);
|
||||
}
|
||||
|
||||
} else /* MainPlayer.PlayerType.POPUP */ {
|
||||
final View closingOverlayView = playerImpl.getClosingOverlayView();
|
||||
|
@ -132,7 +137,6 @@ public class PlayerGestureListener
|
|||
}
|
||||
|
||||
private void onScrollMainVolume(final float distanceX, final float distanceY) {
|
||||
if (isVolumeGestureEnabled) {
|
||||
playerImpl.getVolumeProgressBar().incrementProgressBy((int) distanceY);
|
||||
final float currentProgressPercent = (float) playerImpl
|
||||
.getVolumeProgressBar().getProgress() / playerImpl.getMaxGestureLength();
|
||||
|
@ -158,10 +162,8 @@ public class PlayerGestureListener
|
|||
playerImpl.getBrightnessRelativeLayout().setVisibility(View.GONE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void onScrollMainBrightness(final float distanceX, final float distanceY) {
|
||||
if (isBrightnessGestureEnabled) {
|
||||
final Activity parent = playerImpl.getParentActivity();
|
||||
if (parent == null) {
|
||||
return;
|
||||
|
@ -202,7 +204,6 @@ public class PlayerGestureListener
|
|||
playerImpl.getVolumeRelativeLayout().setVisibility(View.GONE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onScrollEnd(@NotNull final MainPlayer.PlayerType playerType,
|
||||
|
|
Loading…
Reference in New Issue