Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
Co-authored-by: Marc Durdin <[email protected]>
  • Loading branch information
darcywong00 and mcdurdin authored May 16, 2024
1 parent 205c8c2 commit 0be1937
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions android/KMEA/app/src/main/java/com/keyman/engine/KMManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -2078,17 +2078,17 @@ public static void applyKeyboardHeight(Context context, int height) {
*/
public static Point getWindowSize(Context context) {
WindowManager wm = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
WindowMetrics windowMetrics = wm.getCurrentWindowMetrics();
return new Point(
windowMetrics.getBounds().width(),
windowMetrics.getBounds().height());
}

// Deprecated in API 30
Point size = new Point(0, 0);
wm.getDefaultDisplay().getSize(size);
return size;
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.R) {
// Deprecated in API 30
Point size = new Point(0, 0);
wm.getDefaultDisplay().getSize(size);
return size;
}
WindowMetrics windowMetrics = wm.getCurrentWindowMetrics();
return new Point(
windowMetrics.getBounds().width(),
windowMetrics.getBounds().height());
}

public static float getWindowDensity(Context context) {
Expand Down

0 comments on commit 0be1937

Please sign in to comment.