Commit e50167ef by bachinger Committed by Oliver Woodman

prevent controls from hiding whilst the user is interacting with it

Issue:#2395

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=202926448
parent caa90844
...@@ -25,6 +25,7 @@ import android.support.annotation.Nullable; ...@@ -25,6 +25,7 @@ import android.support.annotation.Nullable;
import android.util.AttributeSet; import android.util.AttributeSet;
import android.view.KeyEvent; import android.view.KeyEvent;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.MotionEvent;
import android.view.View; import android.view.View;
import android.widget.FrameLayout; import android.widget.FrameLayout;
import android.widget.ImageView; import android.widget.ImageView;
...@@ -946,6 +947,16 @@ public class PlayerControlView extends FrameLayout { ...@@ -946,6 +947,16 @@ public class PlayerControlView extends FrameLayout {
} }
@Override @Override
public final boolean dispatchTouchEvent(MotionEvent ev) {
if (ev.getAction() == MotionEvent.ACTION_DOWN) {
removeCallbacks(hideAction);
} else if (ev.getAction() == MotionEvent.ACTION_UP) {
hideAfterTimeout();
}
return super.dispatchTouchEvent(ev);
}
@Override
public boolean dispatchKeyEvent(KeyEvent event) { public boolean dispatchKeyEvent(KeyEvent event) {
return dispatchMediaKeyEvent(event) || super.dispatchKeyEvent(event); return dispatchMediaKeyEvent(event) || super.dispatchKeyEvent(event);
} }
...@@ -1035,7 +1046,6 @@ public class PlayerControlView extends FrameLayout { ...@@ -1035,7 +1046,6 @@ public class PlayerControlView extends FrameLayout {
@Override @Override
public void onScrubStart(TimeBar timeBar, long position) { public void onScrubStart(TimeBar timeBar, long position) {
removeCallbacks(hideAction);
scrubbing = true; scrubbing = true;
} }
...@@ -1052,7 +1062,6 @@ public class PlayerControlView extends FrameLayout { ...@@ -1052,7 +1062,6 @@ public class PlayerControlView extends FrameLayout {
if (!canceled && player != null) { if (!canceled && player != null) {
seekToTimeBarPosition(position); seekToTimeBarPosition(position);
} }
hideAfterTimeout();
} }
@Override @Override
...@@ -1116,7 +1125,6 @@ public class PlayerControlView extends FrameLayout { ...@@ -1116,7 +1125,6 @@ public class PlayerControlView extends FrameLayout {
controlDispatcher.dispatchSetShuffleModeEnabled(player, !player.getShuffleModeEnabled()); controlDispatcher.dispatchSetShuffleModeEnabled(player, !player.getShuffleModeEnabled());
} }
} }
hideAfterTimeout();
} }
} }
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment