mirror of
https://github.com/VibedByKaKi/alexandroid.git
synced 2026-11-18 11:57:18 +01:00
55 lines
1.9 KiB
Java
55 lines
1.9 KiB
Java
package com.google.android.material.internal;
|
|
|
|
import android.content.Context;
|
|
import android.graphics.Point;
|
|
import android.graphics.Rect;
|
|
import android.os.Build;
|
|
import android.view.Display;
|
|
import android.view.WindowManager;
|
|
import androidx.annotation.NonNull;
|
|
import androidx.annotation.RequiresApi;
|
|
import androidx.annotation.RestrictTo;
|
|
|
|
/* compiled from: r8-map-id-b9432e0f623b4a4bff4ba50a8a24c4aafad2c1e11092747b9fb5e6a22af5a940 */
|
|
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP})
|
|
/* loaded from: classes7.dex */
|
|
public class WindowUtils {
|
|
|
|
/* compiled from: r8-map-id-b9432e0f623b4a4bff4ba50a8a24c4aafad2c1e11092747b9fb5e6a22af5a940 */
|
|
public static class Api17Impl {
|
|
private Api17Impl() {
|
|
}
|
|
|
|
@NonNull
|
|
public static Rect getCurrentWindowBounds(@NonNull WindowManager windowManager) {
|
|
Display defaultDisplay = windowManager.getDefaultDisplay();
|
|
Point point = new Point();
|
|
defaultDisplay.getRealSize(point);
|
|
Rect rect = new Rect();
|
|
rect.right = point.x;
|
|
rect.bottom = point.y;
|
|
return rect;
|
|
}
|
|
}
|
|
|
|
/* compiled from: r8-map-id-b9432e0f623b4a4bff4ba50a8a24c4aafad2c1e11092747b9fb5e6a22af5a940 */
|
|
@RequiresApi(api = 30)
|
|
public static class Api30Impl {
|
|
private Api30Impl() {
|
|
}
|
|
|
|
@NonNull
|
|
public static Rect getCurrentWindowBounds(@NonNull WindowManager windowManager) {
|
|
return windowManager.getCurrentWindowMetrics().getBounds();
|
|
}
|
|
}
|
|
|
|
private WindowUtils() {
|
|
}
|
|
|
|
@NonNull
|
|
public static Rect getCurrentWindowBounds(@NonNull Context context) {
|
|
WindowManager windowManager = (WindowManager) context.getSystemService("window");
|
|
return Build.VERSION.SDK_INT >= 30 ? Api30Impl.getCurrentWindowBounds(windowManager) : Api17Impl.getCurrentWindowBounds(windowManager);
|
|
}
|
|
}
|