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 PopupWindow.update()
This commit is contained in:
@@ -47,6 +47,14 @@ JNIEXPORT jboolean JNICALL Java_android_widget_PopupWindow_native_1isShowing
|
||||
JNIEXPORT void JNICALL Java_android_widget_PopupWindow_native_1dismiss
|
||||
(JNIEnv *, jobject, jlong);
|
||||
|
||||
/*
|
||||
* Class: android_widget_PopupWindow
|
||||
* Method: native_update
|
||||
* Signature: (JJIIII)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_android_widget_PopupWindow_native_1update
|
||||
(JNIEnv *, jobject, jlong, jlong, jint, jint, jint, jint);
|
||||
|
||||
/*
|
||||
* Class: android_widget_PopupWindow
|
||||
* Method: setOnDismissListener
|
||||
|
||||
@@ -68,3 +68,13 @@ JNIEXPORT void JNICALL Java_android_widget_PopupWindow_native_1dismiss(JNIEnv *e
|
||||
{
|
||||
gtk_popover_popdown(GTK_POPOVER(_PTR(popover_ptr)));
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL Java_android_widget_PopupWindow_native_1update(JNIEnv *env, jobject this, jlong popover_ptr, jlong anchor_ptr, jint x, jint y, jint width, jint height)
|
||||
{
|
||||
GtkPopover *popover = GTK_POPOVER(_PTR(popover_ptr));
|
||||
WrapperWidget *anchor = WRAPPER_WIDGET(gtk_widget_get_parent(GTK_WIDGET(_PTR(anchor_ptr))));
|
||||
gtk_widget_set_size_request(GTK_WIDGET(popover), width, height);
|
||||
gtk_widget_insert_before(GTK_WIDGET(popover), GTK_WIDGET(anchor), NULL);
|
||||
gtk_popover_present(GTK_POPOVER(popover));
|
||||
gtk_popover_popup(popover);
|
||||
}
|
||||
|
||||
@@ -669,9 +669,9 @@ public class ListPopupWindow {
|
||||
|
||||
mPopup.setOutsideTouchable(!mForceIgnoreOutsideTouch && !mDropDownAlwaysVisible);
|
||||
|
||||
// mPopup.update(getAnchorView(), mDropDownHorizontalOffset,
|
||||
// mDropDownVerticalOffset, (widthSpec < 0)? -1 : widthSpec,
|
||||
// (heightSpec < 0)? -1 : heightSpec);
|
||||
mPopup.update(getAnchorView(), mDropDownHorizontalOffset,
|
||||
mDropDownVerticalOffset, (widthSpec < 0)? -1 : widthSpec,
|
||||
(heightSpec < 0)? -1 : heightSpec);
|
||||
// mPopup.getContentView().restoreDefaultFocus();
|
||||
} else {
|
||||
final int widthSpec;
|
||||
|
||||
@@ -45,6 +45,7 @@ public class PopupWindow {
|
||||
protected native void native_showAsDropDown(long widget, long anchor, int xoff, int yoff, int gravity);
|
||||
protected native boolean native_isShowing(long widget);
|
||||
protected native void native_dismiss(long widget);
|
||||
protected native void native_update(long widget, long anchor, int xoff, int yoff, int width, int height);
|
||||
|
||||
public void setBackgroundDrawable(Drawable background) {}
|
||||
|
||||
@@ -109,4 +110,8 @@ public class PopupWindow {
|
||||
public void setTouchModal(boolean touchModal) {}
|
||||
|
||||
public void setElevation(float elevation) {}
|
||||
|
||||
public void update(View anchor, int xoff, int yoff, int width, int height) {
|
||||
native_update(popover, anchor.widget, xoff, yoff, width, height);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user