Commit 642a06cc authored by Sébastien Toque's avatar Sébastien Toque

ICS: show overlay when the system bar appears.

It is necessary to check if the visibility has changed, because the listener can be called several times in a row with the same visibility.
parent 00d189a5
......@@ -107,6 +107,7 @@ public class VideoPlayerActivity extends Activity {
private static final int HIDE_NAV = 5;
private boolean mDragging;
private boolean mShowing;
private int mUiVisibility = -1;
private SeekBar mSeekbar;
private TextView mTitle;
private TextView mSysTime;
......@@ -149,11 +150,12 @@ public class VideoPlayerActivity extends Activity {
if(Util.isICSOrLater())
getWindow().getDecorView().findViewById(android.R.id.content).setOnSystemUiVisibilityChangeListener(
new OnSystemUiVisibilityChangeListener() {
@Override
@TargetApi(14)
public void onSystemUiVisibilityChange(int visibility) {
if(visibility == View.SYSTEM_UI_FLAG_VISIBLE && Util.isICSOrLater())
if (visibility == View.SYSTEM_UI_FLAG_VISIBLE && !mShowing && visibility != mUiVisibility) {
showOverlay();
mHandler.sendMessageDelayed(mHandler.obtainMessage(HIDE_NAV), OVERLAY_TIMEOUT);
}
mUiVisibility = visibility;
}
}
);
......
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 to comment