Skip to content

Commit

Permalink
use config_showNavigationBar resource value instead of hasPermanentMe…
Browse files Browse the repository at this point in the history
…nuKey() - fixes #13
  • Loading branch information
jgilfelt committed Mar 19, 2014
1 parent 579d6b2 commit c47710d
Showing 1 changed file with 7 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
import android.util.TypedValue;
import android.view.Gravity;
import android.view.View;
import android.view.ViewConfiguration;
import android.view.ViewGroup;
import android.view.Window;
import android.view.WindowManager;
Expand Down Expand Up @@ -379,10 +378,7 @@ private int getNavigationBarHeight(Context context) {
Resources res = context.getResources();
int result = 0;
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
int resourceId = res.getIdentifier(SHOW_NAV_BAR_RES_NAME, "bool", "android");
boolean hasNavBar = (resourceId > 0) ? res.getBoolean(resourceId) : false;
//if (!ViewConfiguration.get(context).hasPermanentMenuKey()) {
if (hasNavBar) {
if (getInternalBoolean(res, SHOW_NAV_BAR_RES_NAME)) {
String key;
if (mInPortrait) {
key = NAV_BAR_HEIGHT_RES_NAME;
Expand All @@ -400,13 +396,18 @@ private int getNavigationBarWidth(Context context) {
Resources res = context.getResources();
int result = 0;
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
if (!ViewConfiguration.get(context).hasPermanentMenuKey()) {
if (getInternalBoolean(res, SHOW_NAV_BAR_RES_NAME)) {
return getInternalDimensionSize(res, NAV_BAR_WIDTH_RES_NAME);
}
}
return result;
}

private boolean getInternalBoolean(Resources res, String key) {
int resourceId = res.getIdentifier(key, "bool", "android");
return (resourceId > 0) ? res.getBoolean(resourceId) : false;
}

private int getInternalDimensionSize(Resources res, String key) {
int result = 0;
int resourceId = res.getIdentifier(key, "dimen", "android");
Expand Down

0 comments on commit c47710d

Please sign in to comment.