You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cordova.apache.org by GitBox <gi...@apache.org> on 2020/04/23 10:22:44 UTC

[GitHub] [cordova-plugin-statusbar] 0x253 commented on a change in pull request #134: feat: get statusbar height (top-inset)

0x253 commented on a change in pull request #134:
URL: https://github.com/apache/cordova-plugin-statusbar/pull/134#discussion_r413696510



##########
File path: src/android/StatusBar.java
##########
@@ -206,6 +212,16 @@ public void run() {
         return false;
     }
 
+    private float getStatusBarHeight() {
+        float statusBarHeight = 0;
+        int resourceId = cordova.getActivity().getResources().getIdentifier("status_bar_height", "dimen", "android");
+        if (resourceId > 0) {
+            float scaleRatio = cordova.getActivity().getResources().getDisplayMetrics().density;
+            statusBarHeight = cordova.getActivity().getResources().getDimension(resourceId) / scaleRatio;
+        }
+        return statusBarHeight;

Review comment:
       Perhaps https://developer.mozilla.org/en-US/docs/Web/API/Window/orientationchange_event could help to detect the screen orientation change and recompute the statusbar height?




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For additional commands, e-mail: issues-help@cordova.apache.org