You've already forked android_translation_layer
mirror of
https://gitlab.com/android_translation_layer/android_translation_layer.git
synced 2025-10-27 11:48:10 -07:00
HACK: prevent window height of 0
For some reason some apps like LibreSudoku try to create Dialog and Popup windows with height = 0. Prevent this on the window side until the measurement error is fixed.
This commit is contained in:
@@ -93,7 +93,7 @@ public class Window {
|
||||
}
|
||||
|
||||
public void setAttributes(WindowManager.LayoutParams params) {
|
||||
set_layout(native_window, params.width, params.height);
|
||||
setLayout(params.width, params.height);
|
||||
}
|
||||
|
||||
public void takeSurface(SurfaceHolder.Callback2 callback) {}
|
||||
@@ -105,6 +105,8 @@ public class Window {
|
||||
public void setFormat(int format) {}
|
||||
|
||||
public void setLayout(int width, int height) {
|
||||
if (height == 0) // FIXME: remove this hack once measurement error with composeUI dialogs is fixed
|
||||
height = 500;
|
||||
set_layout(native_window, width, height);
|
||||
}
|
||||
|
||||
|
||||
@@ -8,6 +8,8 @@ public class WindowManagerImpl implements WindowManager, ViewManager {
|
||||
@Override
|
||||
public void addView(View view, android.view.ViewGroup.LayoutParams params) {
|
||||
System.out.println("WindowManagerImpl.addView(" + view + ", " + params + ") called");
|
||||
if (params.height == 0) // FIXME: remove this hack once measurement error with composeUI popups is fixed
|
||||
params.height = 200;
|
||||
view.setLayoutParams(params);
|
||||
view.onAttachedToWindow();
|
||||
WindowManager.LayoutParams windowParams = (WindowManager.LayoutParams)params;
|
||||
@@ -17,6 +19,8 @@ public class WindowManagerImpl implements WindowManager, ViewManager {
|
||||
@Override
|
||||
public void updateViewLayout(View view, android.view.ViewGroup.LayoutParams params) {
|
||||
System.out.println("WindowManagerImpl.updateViewLayout(" + view + ", " + params + ") called");
|
||||
if (params.height == 0) // FIXME: remove this hack once measurement error with composeUI popups is fixed
|
||||
params.height = 200;
|
||||
WindowManager.LayoutParams windowParams = (WindowManager.LayoutParams)params;
|
||||
view.setLayoutParams(params);
|
||||
native_updateViewLayout(view.widget, windowParams.x, windowParams.y, params.width, params.height);
|
||||
|
||||
Reference in New Issue
Block a user