|
|
@@ -3,6 +3,7 @@
|
|
|
*/
|
|
|
package kr.co.zumo.app.lifeplus.util;
|
|
|
|
|
|
+import android.content.Context;
|
|
|
import android.content.res.ColorStateList;
|
|
|
import android.graphics.drawable.Drawable;
|
|
|
import android.support.annotation.ArrayRes;
|
|
|
@@ -12,7 +13,11 @@ import android.support.annotation.DrawableRes;
|
|
|
import android.support.annotation.IdRes;
|
|
|
import android.support.annotation.StringRes;
|
|
|
import android.support.v4.content.ContextCompat;
|
|
|
+import android.util.DisplayMetrics;
|
|
|
+import android.util.Log;
|
|
|
import android.util.TypedValue;
|
|
|
+import android.view.Display;
|
|
|
+import android.view.WindowManager;
|
|
|
|
|
|
import kr.co.zumo.app.lifeplus.application.App;
|
|
|
|
|
|
@@ -174,17 +179,47 @@ public class ResourceUtil {
|
|
|
|
|
|
|
|
|
/**
|
|
|
- * 네비게이션 바 높이 (하단 바)
|
|
|
+ * 네비게이션 바 높이 값 (하단 바)
|
|
|
+ * - 네비게이션 바 보여짐과 상관없이 설정된 높이 값을 반환
|
|
|
*
|
|
|
* @return
|
|
|
*/
|
|
|
- public static int getNavigationBarHeight() {
|
|
|
+ public static int getNavBarHeightValue() {
|
|
|
int navigationBarHeight = 0;
|
|
|
int resourceId = App.getInstance().getContext().getResources().getIdentifier("navigation_bar_height", "dimen", "android");
|
|
|
if (resourceId > 0) {
|
|
|
navigationBarHeight = App.getInstance().getContext().getResources().getDimensionPixelSize(resourceId);
|
|
|
}
|
|
|
-// Log.e("APP# ActivityBase | getNavigationBarHeight", "|" + navigationBarHeight);
|
|
|
+// Log.e("APP# ResourceUtil | getNavBarHeightValue", "|" + navigationBarHeight);
|
|
|
return navigationBarHeight;
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 네비게이션 바의 유무에 따른 높이값 반환
|
|
|
+ * - 표시되고 있으면 높이 값 반환, 표시되지 않으면 0 반환
|
|
|
+ *
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public static int getNavBarHeight() {
|
|
|
+ // getRealMetrics is only available with API 17 and +
|
|
|
+ WindowManager wm = (WindowManager) App.getInstance().getContext().getSystemService(Context.WINDOW_SERVICE);
|
|
|
+ if (wm != null) {
|
|
|
+ Display display = wm.getDefaultDisplay();
|
|
|
+ DisplayMetrics metrics = new DisplayMetrics();
|
|
|
+ display.getMetrics(metrics);
|
|
|
+ int usableHeight = metrics.heightPixels;
|
|
|
+ display.getRealMetrics(metrics);
|
|
|
+ int realHeight = metrics.heightPixels;
|
|
|
+ Log.w("APP# ResourceUtil | getNavBarHeight", "|" + "usableHeight: " + usableHeight + ", realHeight: " + realHeight);
|
|
|
+ if (realHeight > usableHeight) {
|
|
|
+ return realHeight - usableHeight;
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ return 0;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ return 0;
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|