Android Question "Pop-up view" mode: how to detect size change in window / display rec?

bsnqt

Active Member
Licensed User
Longtime User
Hi all

Samsung phones (I am not sure others) allow users to switch app from "normal view" to so called "split view" and "pop-up view" mode.

I need to detect size change events (or visibility, or something similar) of the window and display rectangles.

I tried to search but did not success. Found one or two threads, like this one "Immersive Mode" and this one
From that I thought I can use VisibilityChanged_Event but on the developer site it says This interface was deprecated in API level 30.

The reason I need solution for the questions above is that (please see photo) when the user pulls the edge of the "logical display" hosting my Activity, it leave a blank space (Activity does not change size while the logical display became bigger after user ceases his screen touch). Normally the app can resize itself ("automatically") to fill the new display but I see it does not auto resize all the times. I have created a simple app to test and see that it auto resizes quite often with pop-up view mode but fails and leaves the blank space some times. So I need to catch the event to resize my layout / activity accordingly to the new display size.

screen.png


I am not asking about how to resize the activity as well as how to get the window and display size (use IME2 from Agraham), but I am asking how to intercept when the user change the logical display size.

From agraham's IME2 library:
'    GetWindowRectangle gets the location And dimensions of the Activity's window as a Rect. These values are absolute pixel values relative To the physical display screen.
'    They define the size And location on screen of the visible portion of the Activity.

'    GetDisplayRectangle gets the dimensions of the Display on which the Activity Is being drawn As a Rect. These values are absolute pixel values, Left And Top are always 0. When Not in split screen mode these values reflect those of the full physical display of the device. In split mode they define the size of a smaller logical display hosting the Activity.

I have tried: IME, IME2 as well as thread "user interaction" advice from Erel, but no avail. The issue with the last one (user interaction) is that every time when user interacts with the app (like he click on any view), the event will be triggered and the app layout will be resize unwantedly.

#if Java
@Override
public void onUserInteraction() {
processBA.raiseEventFromUI(null, "user_interaction");
}
#End If
 
Last edited:
Top