• 1
  • 2(current)
  • 3
  • 4
  • 5
  • 10
auto hide/show lower nav bar.
#16
Hidding the bar completely is no more supported in ICS+ Sad Only some custom roms cheats and allow this Sad

To hide the buttons the code is easy at least in JNI :

Code:
            if (android.os.Build.VERSION.SDK_INT >= 11) {
                View view = findViewById(R.id.dimmer).getRootView();
                if (android.os.Build.VERSION.SDK_INT >= 14) {
                    view.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LOW_PROFILE);
                } else {
                    view.setSystemUiVisibility(View.STATUS_BAR_HIDDEN);
                }
            }
Reply
#17
I looked into it once but ran into a few bumps + my SGS2 doesn't have the navigation bar because it has hardware buttons so I wouldn't have been able to test it anyway. From fading memory here are a few things to consider:
  • As already mentioned the navigation bars differ between GB, HC and ICS+ and IIRC they need to be handled differently in the code.
  • The Java API necessary to hide the ICS+ navigation bar is obviously not accessible in GB so not sure if we can target android-9 but still access those methods and constants which were introduced with android-11 or android-14.
  • Last time I checked we didn't have any code in place to handle resolution changes. So when showing the navigation bar and then hiding it when playing a video, the resolution will change and XBMC would have to handle that.
  • I don't think that we'll be able to achieve this through JNI because we don't have access to the View object in the native activity. In a standard java-based Activity, accessing the view is very easy but I wasn't able to find a native equivalent for it.
@davilla: Might be that I never properly setup the onConfigurationChanged() callback in the native activity because we never needed it so far. It would probably also be needed if we ever wanted to handle screen rotation.
Always read the online manual (wiki), FAQ (wiki) and search the forum before posting.
Do not e-mail Team Kodi members directly asking for support. Read/follow the forum rules (wiki).
Please read the pages on troubleshooting (wiki) and bug reporting (wiki) before reporting issues.
Reply
#18
+1 for screen rotation Smile

At least top / bottom since forced rotation is annoying due to the positioning of the usb charging port in lots of devices Smile

May I ask why targeting an lower api and not last one ?
Reply
#19
(2013-01-16, 09:16)Montellese Wrote:
  • The Java API necessary to hide the ICS+ navigation bar is obviously not accessible in GB so not sure if we can target android-9 but still access those methods and constants which were introduced with android-11 or android-14.

I believe there are ways to use the target / minimum sdk version and conditional logic to prevent higher platform code from crashing on older platforms.
Reply
#20
(2013-01-16, 08:55)Tolriq Wrote: Hidding the bar completely is no more supported in ICS+ Sad Only some custom roms cheats and allow this Sad

To hide the buttons the code is easy at least in JNI :
The code you posted did the trick in the splash screen that is shown during 1st run. Now onto making it work via JNI in the rest of the app. Dots on the bottom are the "hidden" action bar. Screen cap taken on Nexus 7 running 4.2.

Code changes: splash_hide_action_bar.diff

Image
Reply
#21
Exactly.. as my little note posted above with this call in it toggles 'full screen' mode as much as is possible on a stock device. For those of us running CM(9/10x) or PA roms then this will trigger a TRUE full screen mode if 'auto hide combination bar' is enabled.

I think the dimmed black and 3 dots are FAR preferable for those with stock devices than the menu, back, and home buttons which were very distracting Smile

@kemonine96: are the buttons re-appearing when touching the screen without an onTouchEvent to set visible again??
Reply
#22
(2013-01-16, 19:25)manxam Wrote: I think the dimmed black and 3 dots are FAR preferable for those with stock devices than the menu, back, and home buttons which were very distracting Smile
I think this would be beneficial for anyone without hardware buttons. That way you can get home / kill xbmc in the event of a soft or hard lockup.

(2013-01-16, 19:25)manxam Wrote: @kemonine96: are the buttons re-appearing when touching the screen without an onTouchEvent to set visible again??
Not sure, the diff I posted is just a proof of concept in the Java 1st run splash screen. I am working on converting the code to JNI to see if it works on the native activity window currently. I planned on doing more in depth tests as soon as the JNI works.
Reply
#23
Well... I made some progress with the JNI. I'm now getting the below error. Diff attached for the specific JNI code changes.

From what I can tell GUI code can only execute on the GUI thread. I've found a number of ways to solve the crash in Java but nothing from within the NDK. The relavant method call that is supposed to fix the problem is Activity.runOnUiThread(Runnable action). No idea how to setup this call from JNI just yet. Another possibility might be to setup an onCreate method in the native activity, but I am not sure how to go about implementing this either.

Code: app_hide_action_bar.diff

Crash / Error
Code:
E/AndroidRuntime(15254): android.view.ViewRootImpl$CalledFromWrongThreadException: Only the original thread that created a view hierarchy can touch its views.
E/AndroidRuntime(15254):     at android.view.ViewRootImpl.checkThread(ViewRootImpl.java:4746)
E/AndroidRuntime(15254):     at android.view.ViewRootImpl.recomputeViewAttributes(ViewRootImpl.java:2610)
E/AndroidRuntime(15254):     at android.view.ViewGroup.recomputeViewAttributes(ViewGroup.java:1062)
E/AndroidRuntime(15254):     at android.view.ViewGroup.recomputeViewAttributes(ViewGroup.java:1062)
E/AndroidRuntime(15254):     at android.view.View.setSystemUiVisibility(View.java:16016)
E/AndroidRuntime(15254):     at dalvik.system.NativeStart.run(Native Method)
Reply
#24
(2013-01-16, 23:06)kemonine96 Wrote: Well... I made some progress with the JNI. I'm now getting the below error. Diff attached for the specific JNI code changes.

From what I can tell GUI code can only execute on the GUI thread. I've found a number of ways to solve the crash in Java but nothing from within the NDK. The relavant method call that is supposed to fix the problem is Activity.runOnUiThread(Runnable action). No idea how to setup this call from JNI just yet. Another possibility might be to setup an onCreate method in the native activity, but I am not sure how to go about implementing this either.

Code: app_hide_action_bar.diff

Crash / Error
Code:
E/AndroidRuntime(15254): android.view.ViewRootImpl$CalledFromWrongThreadException: Only the original thread that created a view hierarchy can touch its views.
E/AndroidRuntime(15254):     at android.view.ViewRootImpl.checkThread(ViewRootImpl.java:4746)
E/AndroidRuntime(15254):     at android.view.ViewRootImpl.recomputeViewAttributes(ViewRootImpl.java:2610)
E/AndroidRuntime(15254):     at android.view.ViewGroup.recomputeViewAttributes(ViewGroup.java:1062)
E/AndroidRuntime(15254):     at android.view.ViewGroup.recomputeViewAttributes(ViewGroup.java:1062)
E/AndroidRuntime(15254):     at android.view.View.setSystemUiVisibility(View.java:16016)
E/AndroidRuntime(15254):     at dalvik.system.NativeStart.run(Native Method)
That's what I meant with
(2013-01-16, 09:16)Montellese Wrote:
  • I don't think that we'll be able to achieve this through JNI because we don't have access to the View object in the native activity. In a standard java-based Activity, accessing the view is very easy but I wasn't able to find a native equivalent for it.
We can't provide a Runnable implementation from native code. I'm not 100% sure either on what the GUI thread in a native activity is but it might just be the main thread handling all the events like OnPause, OnStop, OnResume etc.
Always read the online manual (wiki), FAQ (wiki) and search the forum before posting.
Do not e-mail Team Kodi members directly asking for support. Read/follow the forum rules (wiki).
Please read the pages on troubleshooting (wiki) and bug reporting (wiki) before reporting issues.
Reply
#25
(2013-01-16, 23:17)Montellese Wrote: That's what I meant with
(2013-01-16, 09:16)Montellese Wrote:
  • I don't think that we'll be able to achieve this through JNI because we don't have access to the View object in the native activity. In a standard java-based Activity, accessing the view is very easy but I wasn't able to find a native equivalent for it.
We can't provide a Runnable implementation from native code. I'm not 100% sure either on what the GUI thread in a native activity is but it might just be the main thread handling all the events like OnPause, OnStop, OnResume etc.

The various posts I read indicated the JNI I posted may be possible from the main thread, but I am not sure how to get the JNIEnv from the main thread. Any ideas?
Reply
#26
Depends on when you have to execute your code. If it can be done during startup you should be able to place it in one of the available callbacks. Otherwise you may have to look into custom events which you can send to the event-loop in the main thread which would then allow you to trigger a method doing your JNI magic in the main thread. You probably need to look into ALooper and android_poll_source etc. I vaguely remember having read that you can trigger custom events but that was quite a while ago when I first looked into implementing the native activity for xbmc.
Always read the online manual (wiki), FAQ (wiki) and search the forum before posting.
Do not e-mail Team Kodi members directly asking for support. Read/follow the forum rules (wiki).
Please read the pages on troubleshooting (wiki) and bug reporting (wiki) before reporting issues.
Reply
#27
(2013-01-16, 23:42)Montellese Wrote: Depends on when you have to execute your code. If it can be done during startup you should be able to place it in one of the available callbacks

The JNI I put together should work from onCreate, which is where I did my initial testing in the Splash.java class. The trick is how can I setup onCreate in the NativeActivity, if that is even possible.
Reply
#28
I don't think there's an onCreate() in a native activity (well you could say it's the whole logic that initializes the native activity) but there are a lot of other events available in CXBMCApp (see https://github.com/xbmc/xbmc/blob/master...pp.cpp#L93 ). I'm not sure if it matters whether you run that code before or after getting the native window because hiding the nav bar might trigger a resolution change.
Always read the online manual (wiki), FAQ (wiki) and search the forum before posting.
Do not e-mail Team Kodi members directly asking for support. Read/follow the forum rules (wiki).
Please read the pages on troubleshooting (wiki) and bug reporting (wiki) before reporting issues.
Reply
#29
The code I gave can be started at any time. And in most cases this does not really hide the bar since unsupported so does not generate resolution change.
Reply
#30
(2013-01-17, 08:48)Tolriq Wrote: The code I gave can be started at any time. And in most cases this does not really hide the bar since unsupported so does not generate resolution change.

Yes, but in a Native Activity you cannot access the graphics system outside of the main thread and I've yet to figure out how to get a reference to the main thread env so the JNI I posted can be called from the right spot.

A few posts up I included the error I was receiving on a build using android-14 as the platform including what I found as a fix, but I cannot figure out how to get the fixes implemented from a native activity.
Reply
  • 1
  • 2(current)
  • 3
  • 4
  • 5
  • 10

Logout Mark Read Team Forum Stats Members Help
auto hide/show lower nav bar.0