|
@@ -1,6 +1,6 @@
|
1
|
1
|
package com.reactnativenavigation.utils;
|
2
|
2
|
|
3
|
|
-import android.content.Context;
|
|
3
|
+import android.app.Activity;
|
4
|
4
|
import android.content.res.Resources;
|
5
|
5
|
import android.graphics.PorterDuff;
|
6
|
6
|
import android.graphics.PorterDuffColorFilter;
|
|
@@ -16,10 +16,8 @@ import android.view.View;
|
16
|
16
|
import android.view.ViewGroup;
|
17
|
17
|
import android.view.ViewParent;
|
18
|
18
|
import android.view.ViewTreeObserver;
|
19
|
|
-import android.view.WindowManager;
|
20
|
19
|
import android.widget.RelativeLayout;
|
21
|
20
|
import android.widget.TextView;
|
22
|
|
-
|
23
|
21
|
import com.reactnativenavigation.NavigationApplication;
|
24
|
22
|
import com.reactnativenavigation.params.AppStyle;
|
25
|
23
|
import com.reactnativenavigation.screens.Screen;
|
|
@@ -74,17 +72,15 @@ public class ViewUtils {
|
74
|
72
|
}
|
75
|
73
|
}
|
76
|
74
|
|
77
|
|
- public static float getScreenHeight() {
|
78
|
|
- WindowManager wm = (WindowManager) NavigationApplication.instance.getSystemService(Context.WINDOW_SERVICE);
|
|
75
|
+ public static float getWindowWidth(Activity activity) {
|
79
|
76
|
DisplayMetrics metrics = new DisplayMetrics();
|
80
|
|
- wm.getDefaultDisplay().getMetrics(metrics);
|
81
|
|
- return metrics.heightPixels;
|
|
77
|
+ activity.getWindowManager().getDefaultDisplay().getMetrics(metrics);
|
|
78
|
+ return metrics.widthPixels;
|
82
|
79
|
}
|
83
|
80
|
|
84
|
|
- public static float getScreenWidth() {
|
85
|
|
- WindowManager wm = (WindowManager) NavigationApplication.instance.getSystemService(Context.WINDOW_SERVICE);
|
|
81
|
+ public static float getWindowHeight(Activity activity) {
|
86
|
82
|
DisplayMetrics metrics = new DisplayMetrics();
|
87
|
|
- wm.getDefaultDisplay().getMetrics(metrics);
|
|
83
|
+ activity.getWindowManager().getDefaultDisplay().getMetrics(metrics);
|
88
|
84
|
return metrics.widthPixels;
|
89
|
85
|
}
|
90
|
86
|
|