Android: Fix workaround view in cheats activity

When using a fullscreen mode on some phones that remove the navigation bar, inset callbacks will not be fired. To account for this we set the workaround view at a height of 1px to prevent the view from filling the entire screen due to this activity using a Constraint layout.
This commit is contained in:
Charles Lombardo 2023-01-06 16:00:56 -05:00
parent 4d86e44c12
commit d32cc1e5eb
2 changed files with 8 additions and 7 deletions

View File

@ -31,12 +31,9 @@ public class InsetsHelper
// navigation bar https://issuetracker.google.com/issues/248761842 // navigation bar https://issuetracker.google.com/issues/248761842
public static void applyNavbarWorkaround(int bottomInset, View workaroundView) public static void applyNavbarWorkaround(int bottomInset, View workaroundView)
{ {
if (bottomInset > 0) ViewGroup.LayoutParams lpWorkaround = workaroundView.getLayoutParams();
{ lpWorkaround.height = bottomInset;
ViewGroup.LayoutParams lpWorkaround = workaroundView.getLayoutParams(); workaroundView.setLayoutParams(lpWorkaround);
lpWorkaround.height = bottomInset;
workaroundView.setLayoutParams(lpWorkaround);
}
} }
public static int getSystemGestureType(Context context) public static int getSystemGestureType(Context context)

View File

@ -58,10 +58,14 @@
</androidx.slidingpanelayout.widget.SlidingPaneLayout> </androidx.slidingpanelayout.widget.SlidingPaneLayout>
<!-- We have to set the layout height at 1px because when a device forces fullscreen mode,
inset callbacks are not triggered and using 0dp will make this view cover the entire
display since this activity uses a constraint layout. Now, even if the callback isn't
triggered, this view will remain at 1px height. -->
<View <View
android:id="@+id/workaround_view" android:id="@+id/workaround_view"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="0dp" android:layout_height="1px"
android:layout_gravity="bottom" android:layout_gravity="bottom"
android:background="@android:color/transparent" android:background="@android:color/transparent"
android:clickable="true" android:clickable="true"