Fix issue where reaction shade is offset in chat bubbles.

Fixes #10843
This commit is contained in:
Greyson Parrelli
2021-02-01 10:23:22 -05:00
parent e9e2846532
commit 0b7c22886d
3 changed files with 16 additions and 2 deletions

View File

@@ -1,6 +1,7 @@
package org.thoughtcrime.securesms.util;
import android.app.Activity;
import android.graphics.Rect;
import android.os.Build;
import android.view.View;
import android.view.Window;
@@ -62,6 +63,16 @@ public final class WindowUtil {
window.setStatusBarColor(color);
}
/**
* A sort of roundabout way of determining if the status bar is present by seeing if there's a
* vertical window offset.
*/
public static boolean isStatusBarPresent(@NonNull Window window) {
Rect rectangle = new Rect();
window.getDecorView().getWindowVisibleDisplayFrame(rectangle);
return rectangle.top > 0;
}
private static void clearSystemUiFlags(@NonNull Window window, int flags) {
View view = window.getDecorView();
int uiFlags = view.getSystemUiVisibility();