B4A Library [Class] ICS Navigation Bar Control

[Library] ICS Navigation Bar Control

Here is a new Library for Android SDK 14+ to turn on and off the Action Bar as well as turn on and off the Navigation Bar in ICS. A project sample is attached.

Requires: B4A 2.5+
Copy the ICSControls.jar and ICSControls.xml to the Extra Libraries folder.


The project Manifest must include this line:
<uses-sdk android:minSdkVersion="4" android:targetSdkVersion="14"/>

ICSControls
  • ActionBarOff
    Turns OFF the ActionBar at the top of screen in ICS
    Increases the screen size
  • ActionBarOn
    Turns ON the ActionBar at the top of screen in ICS
    Decreases the screen size
  • Initialize
    Requires ICS and SDK 14 or greater
    Example:

    Initialize(Activity, Me)
  • NavBarOff
    Turns OFF the Navigation Bar at bottom of ICS
  • NavBarOn
    Turns ON the Navigation Bar at bottom of ICS
 

Attachments

  • ICSControls 1.0.zip
    2.6 KB · Views: 1,224
  • ICSControls_Sample.zip
    7.6 KB · Views: 1,056
Last edited:

Jost aus Soest

Active Member
Licensed User
Longtime User
Thanx for the idea! :)

Unfortunately it's crashing running the example on emulator or Galay Note when I select any button. :(

Here the log:
B4X:
controls_setnavbtns (java line: 112)
java.lang.NoSuchFieldError: anywheresoftware.b4a.BA.activityBA
   at anywheresoftware.b4a.agraham.reflection.Reflection.GetActivity(Reflection.java:638)
   at ics.margret.controls._setnavbtns(controls.java:112)
   at ics.margret.controls._actionbaron(controls.java:43)
   at ics.margret.main._btn4_click(main.java:271)
   at java.lang.reflect.Method.invokeNative(Native Method)
   at java.lang.reflect.Method.invoke(Method.java:511)
   at anywheresoftware.b4a.BA.raiseEvent2(BA.java:165)
   at anywheresoftware.b4a.BA.raiseEvent2(BA.java:153)
   at anywheresoftware.b4a.BA.raiseEvent(BA.java:149)
   at anywheresoftware.b4a.objects.ViewWrapper$1.onClick(ViewWrapper.java:55)
   at android.view.View.performClick(View.java:3627)
   at android.view.View$PerformClick.run(View.java:14329)
   at android.os.Handler.handleCallback(Handler.java:605)
   at android.os.Handler.dispatchMessage(Handler.java:92)
   at android.os.Looper.loop(Looper.java:137)
   at android.app.ActivityThread.main(ActivityThread.java:4511)
   at java.lang.reflect.Method.invokeNative(Native Method)
   at java.lang.reflect.Method.invoke(Method.java:511)
   at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:980)
   at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:747)
   at dalvik.system.NativeStart.main(Native Method)
 

Jost aus Soest

Active Member
Licensed User
Longtime User
check for updates

You are using an old version of Reflection library. You should update it.

:BangHead:

We really need an automatic library update system (or at least an automatic information / check for updates system, e. g.: "New Reflection-library available!")!
 

pixelpop

Active Member
Licensed User
Longtime User
Margret: This works very good for hiding the soft keys. But after the soft keys are hidden, is there a way to allow the activity to use this area? I'm not interested in placing views or controls here, just have the activity background expand to the bottom of the screen.

On my device, if I am on the Home screen and hide the soft keys, the wallpaper expands (or perhaps the screen is scaled, since the icons on the Home screen also shift downward) to fill the entire screen.
 

AHilton

Active Member
Licensed User
Longtime User
The action bar buttons are doing the same thing as the navigation bar buttons are doing in the demo. ie Turning on and off the navigation bar at the bottom of the screen. The action bar isn't showing at all. Any ideas?

ASUS Transformer Pad TF300T
Android 4.1.1
Manifest file set as instructed.
 

AHilton

Active Member
Licensed User
Longtime User
I tried fiddling with some system settings on that tablet with no change. Tried various changes to the manifest for different targeted SDK's and no change. Oh well, no time to dwell...
 

Toley

Active Member
Licensed User
Longtime User
Hello, I've try this and the navigation bar is replaced by small dots. It's ok they are nearly invisible. The problem is that they are still active. If someone click on the bar, it re appear and works like before. Is there a way to completly disable the buttons ?
 

margret

Well-Known Member
Licensed User
Longtime User
These controls are part of the OS. There is no way to get ride of them. This lib does just as you stated and dims the controls. The dots are there showing where the control icons have been dimmed. My main reason for writing this lib was I needed them off when watching videos. In this setup, I have a timer that updates the position every second and if my control is not visible, it calls the function to turn off the controls. This way they stay off even if you have touched the screen in that area. I am still trying to find a way to turn them off and use that screen area for an app but I don't think it can be done.
 

almontgreen

Active Member
Licensed User
Longtime User
These controls are part of the OS. There is no way to get ride of them. This lib does just as you stated and dims the controls. The dots are there showing where the control icons have been dimmed. My main reason for writing this lib was I needed them off when watching videos. In this setup, I have a timer that updates the position every second and if my control is not visible, it calls the function to turn off the controls. This way they stay off even if you have touched the screen in that area. I am still trying to find a way to turn them off and use that screen area for an app but I don't think it can be done.

ICS.ActionBarOn hides the bar at the bottom on a QC802 MiniPC but takes away the focus for events that would otherwise go to a panel or activity. This problem is beyond my paygrade ;^) and I am at a loss of what to do to hide the bar at the bottom and capture mouse events (also to hide the freaking mouse cursor!)

Seems like this should be a capability - to free up the screen for video full screen and to capture mouse scroll wheel and clicks without putting stuff on the screen. Very frustrating!
 

rworner

Member
Licensed User
Longtime User
This class has been converted to a library. Post #1 has the updated library and B4A sample code.
The library worked great on the first devices that I used it on. Now we have upgraded to new devices and it no longer works (4.1.1). Are there any plans to upgrade the library, or is there a different way to achieve the same result with the later OSs?

Many Thanks
 

margret

Well-Known Member
Licensed User
Longtime User
I have a MK808B and this code works fine on it. The latest version of Android I have running on a device to work with and test on, is version 4.0.3. It works on these devices and the others with older versions. I would be glad to try and see what the issues are but it would require a new device or an upgraded OS. These are not available for any of my devices at the current time. If the manufactures do come out with an update to the OS for any of the devices I use, I will see what can be done to correct this. I agree that the OS should allow us to use the whole screen for our apps and/or video.
 

almontgreen

Active Member
Licensed User
Longtime User
I ended up deleting the system_UI.apk and that gets rid of the bar. Seems to work on most MiniPC devices. Probably not the best approach, but it works and so far there haven't been any unexpected consequences.
 

pixelpop

Active Member
Licensed User
Longtime User
I ended up deleting the system_UI.apk and that gets rid of the bar. Seems to work on most MiniPC devices. Probably not the best approach, but it works and so far there haven't been any unexpected consequences.

The "bar" you're talking about is the soft keys at the bottom of the screen, correct? Not sure I would want to delete the apk, but would renaming it accomplish the same thing?
 
Top