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
implement WindowManager for composeUI popups
currently everything is created as GtkPopover which is not ideal for toplevel windows, so print a warning in that case.
This commit is contained in:
@@ -8,16 +8,31 @@ 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");
|
||||
view.setLayoutParams(params);
|
||||
view.onAttachedToWindow();
|
||||
WindowManager.LayoutParams windowParams = (WindowManager.LayoutParams)params;
|
||||
native_addView(view.widget, windowParams.type, windowParams.x, windowParams.y, params.width, params.height);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateViewLayout(View view, android.view.ViewGroup.LayoutParams params) {
|
||||
System.out.println("WindowManagerImpl.updateViewLayout(" + view + ", " + params + ") called");
|
||||
WindowManager.LayoutParams windowParams = (WindowManager.LayoutParams)params;
|
||||
view.setLayoutParams(params);
|
||||
native_updateViewLayout(view.widget, windowParams.x, windowParams.y, params.width, params.height);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeView(View view) {
|
||||
// TODO Auto-generated method stub
|
||||
throw new UnsupportedOperationException("Unimplemented method 'removeView'");
|
||||
native_removeView(view.widget);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeViewImmediate(View view) {
|
||||
removeView(view);
|
||||
}
|
||||
|
||||
private static native void native_addView(long widget, int type, int x, int y, int width, int height);
|
||||
private static native void native_updateViewLayout(long widget, int x, int y, int width, int height);
|
||||
private static native void native_removeView(long widget);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user