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
|
* Class: android_widget_CheckBox
|
||||||
* Method: setText
|
* Method: native_setText
|
||||||
* Signature: (Ljava/lang/CharSequence;)V
|
* Signature: (JLjava/lang/String;)V
|
||||||
*/
|
*/
|
||||||
JNIEXPORT void JNICALL Java_android_widget_CheckBox_setText
|
JNIEXPORT void JNICALL Java_android_widget_CheckBox_native_1setText
|
||||||
(JNIEnv *, jobject, jobject);
|
(JNIEnv *, jobject, jlong, jstring);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#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) {
|
if (text == NULL) {
|
||||||
gtk_check_button_set_label(button, NULL);
|
gtk_check_button_set_label(button, NULL);
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ public class Button extends TextView {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected native long native_constructor(Context context, AttributeSet attrs);
|
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
|
@Override
|
||||||
protected native void nativeSetOnClickListener(long widget);
|
protected native void nativeSetOnClickListener(long widget);
|
||||||
protected native void native_setCompoundDrawables(long widget, long paintable);
|
protected native void native_setCompoundDrawables(long widget, long paintable);
|
||||||
|
|||||||
@@ -28,7 +28,9 @@ public class CheckBox extends CompoundButton {
|
|||||||
public native boolean isChecked();
|
public native boolean isChecked();
|
||||||
|
|
||||||
@Override
|
@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
|
// following methods are overridden to prevent calling incompatible methods from superclasses
|
||||||
@Override
|
@Override
|
||||||
@@ -38,4 +40,6 @@ public class CheckBox extends CompoundButton {
|
|||||||
@Override
|
@Override
|
||||||
public void setTextSize(float size) {}
|
public void setTextSize(float size) {}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public native void native_setText(long widget, String text);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user