implement PopupWindow using GtkPopover

This commit is contained in:
Julian Winkler
2024-02-17 15:30:44 +01:00
parent 0bb3d7ce15
commit 9c684ee906
4 changed files with 177 additions and 2 deletions

View File

@@ -1,6 +1,59 @@
package android.widget;
import android.content.Context;
import android.graphics.drawable.Drawable;
import android.util.AttributeSet;
import android.view.View;
public class PopupWindow {
public interface OnDismissListener {}
public PopupWindow(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
popover = native_constructor();
}
private View contentView;
private long popover; // native pointer to GtkPopover
public interface OnDismissListener {
public void onDismiss();
}
protected native long native_constructor();
protected native void native_setContentView(long widget, long contentView);
protected native void native_showAsDropDown(long widget, long anchor, int xoff, int yoff, int gravity);
public void setBackgroundDrawable(Drawable background) {}
public void setInputMethodMode(int mode) {}
public boolean isShowing() {return false;}
public native void setOnDismissListener(OnDismissListener listener);
public void setFocusable(boolean focusable) {}
public Drawable getBackground() {return null;}
public void setContentView(View view) {
contentView = view;
native_setContentView(popover, view.widget);
}
public int getInputMethodMode() {return 0;}
public int getMaxAvailableHeight(View anchor, int yOffset) {return 500;}
public native void setWidth(int width);
public native void setHeight(int height);
public void setOutsideTouchable(boolean touchable) {}
public void setTouchInterceptor(View.OnTouchListener listener) {}
public void showAsDropDown(View anchor, int xoff, int yoff, int gravity) {
native_showAsDropDown(popover, anchor.widget, xoff, yoff, gravity);
}
public View getContentView() {return contentView;}
}