|
|
@@ -224,9 +224,9 @@ object DisplayUtil {
|
|
|
* @return
|
|
|
*/
|
|
|
fun getNavMenuHeight(context: Context): Int {
|
|
|
- if (!isNavMenuExist(context)) {
|
|
|
- return 0
|
|
|
- }
|
|
|
+// if (!isNavMenuExist(context)) {
|
|
|
+// return 0
|
|
|
+// }
|
|
|
|
|
|
if (sNaviBarHeight != -1) {
|
|
|
return sNaviBarHeight
|
|
|
@@ -245,14 +245,15 @@ object DisplayUtil {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- fun isNavMenuExist(context: Context): Boolean {
|
|
|
- //通过判断设备是否有返回键、菜单键(不是虚拟键,是手机屏幕外的按键)来确定是否有navigation bar
|
|
|
- val hasMenuKey = ViewConfiguration.get(context).hasPermanentMenuKey()
|
|
|
- val hasBackKey = KeyCharacterMap.deviceHasKey(KeyEvent.KEYCODE_BACK)
|
|
|
-
|
|
|
- // 做任何你需要做的,这个设备有一个导航栏
|
|
|
- return !hasMenuKey && !hasBackKey
|
|
|
- }
|
|
|
+ //TODO: 判断不准!!!
|
|
|
+// fun isNavMenuExist(context: Context): Boolean {
|
|
|
+// //通过判断设备是否有返回键、菜单键(不是虚拟键,是手机屏幕外的按键)来确定是否有navigation bar
|
|
|
+// val hasMenuKey = ViewConfiguration.get(context).hasPermanentMenuKey()
|
|
|
+// val hasBackKey = KeyCharacterMap.deviceHasKey(KeyEvent.KEYCODE_BACK)
|
|
|
+//
|
|
|
+// // 做任何你需要做的,这个设备有一个导航栏
|
|
|
+// return !hasMenuKey && !hasBackKey
|
|
|
+// }
|
|
|
|
|
|
private fun getResourceNavHeight(context: Context): Int {
|
|
|
// 小米4没有nav bar, 而 navigation_bar_height 有值
|