トラッキング コード

2/02/2012

is Displayed NavigationBar?

The following modules are available in the Frameworks.
PhoneWindowManager#hasNavigationBar()
WindoManagerService#hasNavigationBar()

Check whether there are sources that use this module!!
you can find ViewConfiguration class.

public class ViewConfiguration {
    private ViewConfiguration(Context context) {
             :
        if (!sHasPermanentMenuKeySet) {
            IWindowManager wm = Display.getWindowManager();
            try {
                sHasPermanentMenuKey = wm.canStatusBarHide() && !wm.hasNavigationBar();
                sHasPermanentMenuKeySet = true;
            } catch (RemoteException ex) {
                sHasPermanentMenuKey = false;
            }
        }
             :
    }

    public boolean hasPermanentMenuKey() {
        return sHasPermanentMenuKey;
    }
}

hasPermanentMenuKey() is check "Permanent Menu Key is available."
sHasPermanentMenuKey to determine the value under the following conditions.
wm.canStatusBarHide() : Phone UI or Tablet UI
wm.hasNavigationBar() : Navigation is enable /disable

Tablet UI is disable NavigationBar.
If NavigationBar is disable, sHasPermanentMenuKey is true.
If NavigationBar is enable, sHasPermanentMenuKey is false.

so, you can check using under cord.

//hasPermanentMenuKey == true -> NavigationBar is disable
//hasPermanentMenuKey == false  ->  NavigationBar is enable
boolean isNavigationBar = ! ViewConfiguration.get(this).hasPermanentMenuKey();

1 comment: