Kodi Community Forum

Full Version: Hide system bar while video playing (I've read the FAQ)
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi all,

I've read the faq about how the system bar works have changed in 4.0 and up.

But I wonder why the built-in video player or "MX video player" can hide/dim it and not xbmc?

Thanks,

ask them.
(2013-01-07, 15:09)slybin Wrote: [ -> ]Hi all,

I've read the faq about how the system bar works have changed in 4.0 and up.

But I wonder why the built-in video player or "MX video player" can hide/dim it and not xbmc?

Thanks,

Hidebar

Works as the name implies.
* This application needs ROOT! Only install and use when you have root+busybox+superuser!
* Busybox must be installed and at least once run, a reboot is needed after busybox has been run.

too intrusive for me Smile
I've read about "Hidebar" but I don't want to root my tablet. I was just wondering with other apps can hide/dim the bar and not xbmc.

(2013-01-09, 16:35)slybin Wrote: [ -> ]I've read about "Hidebar" but I don't want to root my tablet. I was just wondering with other apps can hide/dim the bar and not xbmc.

So am I Smile
FYI this is also the case for netflix and hulu+...

I'm no developer but this may help those who are

http://developer.android.com/reference/a...NAVIGATION

it states that user interaction will cause the buttons to reappear (which is the case in netflix and hulu) but I'm sure it could be programmed in such a way that after a wait period they are set to hide again or when a button is pressed (full screen button maybe?).
(2013-01-14, 19:58)CosyCat Wrote: [ -> ]bsplayer autohide systembars

https://play.google.com/store/apps/detai...LmZ1bGwiXQ..

and that helps xbmc how ?
Is it perhaps due to the system reporting that XBMC is running in "windowed mode"? I tried switching the value, and while it does scale the window up and down, the value itself never changes. Not sure what it's reporting back to the android filesystem.

Rooting your device isn't that hard. I managed it on a UG007 a few minutes ago with nothing but ADB and some files gleaned from super1click. All you have to do is have the right ADB drivers for your device, then follow the instructions here to root. Shouldn't take more than fifteen minutes, and the risk level is incredibly minimal.

http://www.pocketables.com/2011/06/how-t...evice.html

I'd just go with a root and hidebar for now. These guys have done an amazing job thus far, and I'm sure the other minimal things will work themselves out shortly...
(2013-01-15, 22:16)digitalhigh Wrote: [ -> ]Is it perhaps due to the system reporting that XBMC is running in "windowed mode"? I tried switching the value, and while it does scale the window up and down, the value itself never changes. Not sure what it's reporting back to the android filesystem.

Nope, guess again. Or you could check the source code and see that "windowed mode" is an artificial construct that means nothing to android.
davilla any luck looking at the system ui flags I posted links to?

SYSTEM_UI_FLAG_HIDE_NAVIGATION
and
SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
seems they would have to be used together

http://developer.android.com/reference/a...ility(int) explains it fairly well. seems you would also use window.FEATURE_ACTION_BAR_OVERLAY so that the application stretches underneath the nav bar even when it's shown for more seamless transitions.

"This second code sample shows a typical implementation of a View in a video playing application. In this situation, while the video is playing the application would like to go into a complete full-screen mode, to use as much of the display as possible for the video. When in this state the user can not interact with the application; the system intercepts touching on the screen to pop the UI out of full screen mode. See fitSystemWindows(Rect) for a sample layout that goes with this code."

Code:
public static class Content extends ImageView implements
        View.OnSystemUiVisibilityChangeListener, View.OnClickListener,
        ActionBar.OnMenuVisibilityListener {
    Activity mActivity;
    TextView mTitleView;
    Button mPlayButton;
    SeekBar mSeekView;
    boolean mAddedMenuListener;
    boolean mMenusOpen;
    boolean mPaused;
    boolean mNavVisible;
    int mLastSystemUiVis;

    Runnable mNavHider = new Runnable() {
        @Override public void run() {
            setNavVisibility(false);
        }
    };

    public Content(Context context, AttributeSet attrs) {
        super(context, attrs);
        setOnSystemUiVisibilityChangeListener(this);
        setOnClickListener(this);
    }

    public void init(Activity activity, TextView title, Button playButton,
            SeekBar seek) {
        // This called by the containing activity to supply the surrounding
        // state of the video player that it will interact with.
        mActivity = activity;
        mTitleView = title;
        mPlayButton = playButton;
        mSeekView = seek;
        mPlayButton.setOnClickListener(this);
        setPlayPaused(true);
    }

    @Override protected void onAttachedToWindow() {
        super.onAttachedToWindow();
        if (mActivity != null) {
            mAddedMenuListener = true;
            mActivity.getActionBar().addOnMenuVisibilityListener(this);
        }
    }

    @Override protected void onDetachedFromWindow() {
        super.onDetachedFromWindow();
        if (mAddedMenuListener) {
            mActivity.getActionBar().removeOnMenuVisibilityListener(this);
        }
    }

    @Override public void onSystemUiVisibilityChange(int visibility) {
        // Detect when we go out of nav-hidden mode, to clear our state
        // back to having the full UI chrome up.  Only do this when
        // the state is changing and nav is no longer hidden.
        int diff = mLastSystemUiVis ^ visibility;
        mLastSystemUiVis = visibility;
        if ((diff&SYSTEM_UI_FLAG_HIDE_NAVIGATION) != 0
                && (visibility&SYSTEM_UI_FLAG_HIDE_NAVIGATION) == 0) {
            setNavVisibility(true);
        }
    }

    @Override protected void onWindowVisibilityChanged(int visibility) {
        super.onWindowVisibilityChanged(visibility);

        // When we become visible or invisible, play is paused.
        setPlayPaused(true);
    }

    @Override public void onClick(View v) {
        if (v == mPlayButton) {
            // Clicking on the play/pause button toggles its state.
            setPlayPaused(!mPaused);
        } else {
            // Clicking elsewhere makes the navigation visible.
            setNavVisibility(true);
        }
    }

    @Override public void onMenuVisibilityChanged(boolean isVisible) {
        mMenusOpen = isVisible;
        setNavVisibility(true);
    }

    void setPlayPaused(boolean paused) {
        mPaused = paused;
        mPlayButton.setText(paused ? R.string.play : R.string.pause);
        setKeepScreenOn(!paused);
        setNavVisibility(true);
    }

    void setNavVisibility(boolean visible) {
        int newVis = SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
                | SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
                | SYSTEM_UI_FLAG_LAYOUT_STABLE;
        if (!visible) {
            newVis |= SYSTEM_UI_FLAG_LOW_PROFILE | SYSTEM_UI_FLAG_FULLSCREEN
                    | SYSTEM_UI_FLAG_HIDE_NAVIGATION;
        }

        // If we are now visible, schedule a timer for us to go invisible.
        if (visible) {
            Handler h = getHandler();
            if (h != null) {
                h.removeCallbacks(mNavHider);
                if (!mMenusOpen && !mPaused) {
                    // If the menus are open or play is paused, we will not auto-hide.
                    h.postDelayed(mNavHider, 1500);
                }
            }
        }

        // Set the new desired visibility.
        setSystemUiVisibility(newVis);
        mTitleView.setVisibility(visible ? VISIBLE : INVISIBLE);
        mPlayButton.setVisibility(visible ? VISIBLE : INVISIBLE);
        mSeekView.setVisibility(visible ? VISIBLE : INVISIBLE);
    }
}
I'll take that as a hint to post this there Smile