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
CheckBox: fix setText() with non-String CharSequence
This commit is contained in:
@@ -233,11 +233,11 @@ JNIEXPORT jboolean JNICALL Java_android_widget_CheckBox_isChecked
|
||||
|
||||
/*
|
||||
* Class: android_widget_CheckBox
|
||||
* Method: setText
|
||||
* Signature: (Ljava/lang/CharSequence;)V
|
||||
* Method: native_setText
|
||||
* Signature: (JLjava/lang/String;)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_android_widget_CheckBox_setText
|
||||
(JNIEnv *, jobject, jobject);
|
||||
JNIEXPORT void JNICALL Java_android_widget_CheckBox_native_1setText
|
||||
(JNIEnv *, jobject, jlong, jstring);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
@@ -46,9 +46,9 @@ JNIEXPORT void JNICALL Java_android_widget_CheckBox_setOnCheckedChangeListener(J
|
||||
}
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL Java_android_widget_CheckBox_setText(JNIEnv *env, jobject this, jstring text)
|
||||
JNIEXPORT void JNICALL Java_android_widget_CheckBox_native_1setText(JNIEnv *env, jobject this, jlong widget_ptr, jstring text)
|
||||
{
|
||||
GtkCheckButton *button = GTK_CHECK_BUTTON(_PTR(_GET_LONG_FIELD(this, "widget")));
|
||||
GtkCheckButton *button = GTK_CHECK_BUTTON(_PTR(widget_ptr));
|
||||
if (text == NULL) {
|
||||
gtk_check_button_set_label(button, NULL);
|
||||
return;
|
||||
|
||||
@@ -37,7 +37,7 @@ public class Button extends TextView {
|
||||
|
||||
@Override
|
||||
protected native long native_constructor(Context context, AttributeSet attrs);
|
||||
public native final void native_setText(long widget, String text);
|
||||
public native void native_setText(long widget, String text);
|
||||
@Override
|
||||
protected native void nativeSetOnClickListener(long widget);
|
||||
protected native void native_setCompoundDrawables(long widget, long paintable);
|
||||
|
||||
@@ -28,7 +28,9 @@ public class CheckBox extends CompoundButton {
|
||||
public native boolean isChecked();
|
||||
|
||||
@Override
|
||||
public native void setText(CharSequence text);
|
||||
public void setText(CharSequence text) {
|
||||
native_setText(widget, text == null ? "" : text.toString());
|
||||
}
|
||||
|
||||
// following methods are overridden to prevent calling incompatible methods from superclasses
|
||||
@Override
|
||||
@@ -38,4 +40,6 @@ public class CheckBox extends CompoundButton {
|
||||
@Override
|
||||
public void setTextSize(float size) {}
|
||||
|
||||
@Override
|
||||
public native void native_setText(long widget, String text);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user