copy AutoCompleteTextView from AOSP

copied from main branch (frameworks/base commit 72ea9148bc619515a649cec9029136e42b342d9b)
This commit is contained in:
Julian Winkler 2025-02-11 18:02:46 +01:00
parent 1cf48085ff
commit c725bb32df
9 changed files with 2889 additions and 29 deletions

View file

@ -31,6 +31,22 @@ JNIEXPORT void JNICALL Java_android_widget_PopupWindow_native_1setContentView
JNIEXPORT void JNICALL Java_android_widget_PopupWindow_native_1showAsDropDown
(JNIEnv *, jobject, jlong, jlong, jint, jint, jint);
/*
* Class: android_widget_PopupWindow
* Method: native_isShowing
* Signature: (J)Z
*/
JNIEXPORT jboolean JNICALL Java_android_widget_PopupWindow_native_1isShowing
(JNIEnv *, jobject, jlong);
/*
* Class: android_widget_PopupWindow
* Method: native_dismiss
* Signature: (J)V
*/
JNIEXPORT void JNICALL Java_android_widget_PopupWindow_native_1dismiss
(JNIEnv *, jobject, jlong);
/*
* Class: android_widget_PopupWindow
* Method: setOnDismissListener

View file

@ -58,3 +58,13 @@ JNIEXPORT void JNICALL Java_android_widget_PopupWindow_setOnDismissListener(JNIE
GtkWidget *popover = GTK_WIDGET(_PTR(_GET_LONG_FIELD(this, "popover")));
g_signal_connect(popover, "closed", G_CALLBACK(on_closed_cb), _REF(listener));
}
JNIEXPORT jboolean JNICALL Java_android_widget_PopupWindow_native_1isShowing(JNIEnv *env, jobject this, jlong popover_ptr)
{
return gtk_widget_get_visible(GTK_WIDGET(_PTR(popover_ptr)));
}
JNIEXPORT void JNICALL Java_android_widget_PopupWindow_native_1dismiss(JNIEnv *env, jobject this, jlong popover_ptr)
{
gtk_popover_popdown(GTK_POPOVER(_PTR(popover_ptr)));
}

View file

@ -17,6 +17,11 @@ public class ContextThemeWrapper extends ContextWrapper {
setTheme(themeResId);
}
public ContextThemeWrapper(Context context, Resources.Theme theme) {
super(context);
this.theme = theme;
}
@Override
public void setTheme(int resid) {
if (theme == null) {

View file

@ -43,7 +43,7 @@ import java.util.List;
* or to have some of data besides toString() results fill the views,
* override {@link #getView(int, View, ViewGroup)} to return the type of view you want.
*/
public class ArrayAdapter<T> extends BaseAdapter /*implements Filterable*/ {
public class ArrayAdapter<T> extends BaseAdapter implements Filterable {
/**
* Contains the list of objects that represent the data of this ArrayAdapter.
* The content of this list is referred to as "the array" in the documentation.

File diff suppressed because it is too large Load diff

View file

@ -16,6 +16,10 @@ public class EditText extends TextView {
super(context, attrs);
}
public EditText(Context context, AttributeSet attrs, int defStyle, int defStyleRes) {
super(context, attrs, defStyle, defStyleRes);
}
@Override
protected native long native_constructor(Context context, AttributeSet attrs);
protected native String native_getText(long widget);

File diff suppressed because it is too large Load diff

View file

@ -43,12 +43,16 @@ public class PopupWindow {
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);
protected native boolean native_isShowing(long widget);
protected native void native_dismiss(long widget);
public void setBackgroundDrawable(Drawable background) {}
public void setInputMethodMode(int mode) {}
public boolean isShowing() {return false;}
public boolean isShowing() {
return native_isShowing(popover);
}
public native void setOnDismissListener(OnDismissListener listener);
@ -58,8 +62,10 @@ public class PopupWindow {
public void setContentView(View view) {
contentView = view;
contentView.attachToWindowInternal();
native_setContentView(popover, view.widget);
if (contentView != null) {
contentView.attachToWindowInternal();
}
native_setContentView(popover, view == null ? 0 : view.widget);
}
public int getInputMethodMode() {return 0;}
@ -95,7 +101,7 @@ public class PopupWindow {
}
public void dismiss() {
System.out.println("PopupWindow.dismiss() called");
native_dismiss(popover);
}
public void setAnimationStyle(int animationStyle) {}

View file

@ -39,6 +39,10 @@ public class TextView extends View {
}
public TextView(Context context, AttributeSet attrs, int defStyleAttr) {
this(context, attrs, defStyleAttr, 0);
}
public TextView(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
super(context, attrs, defStyleAttr);
TypedArray a = context.obtainStyledAttributes(attrs, com.android.internal.R.styleable.TextView, defStyleAttr, 0);