Drawable: stub 'ripple' as transparent ColorDrawable, fix view.setBackgroundColor for buttons

This commit is contained in:
Mis012
2024-02-18 00:30:36 +01:00
parent dddc95ded3
commit 72d6ad9914
4 changed files with 7 additions and 5 deletions

View File

@@ -406,11 +406,11 @@ JNIEXPORT void JNICALL Java_android_view_View_setBackgroundColor(JNIEnv *env, jo
GtkCssProvider *css_provider = gtk_css_provider_new();
char *css_string = g_markup_printf_escaped("* { background-color: #%06x%02x; }", color & 0xFFFFFF, (color >> 24) & 0xFF);
char *css_string = g_markup_printf_escaped("* { background-image: none; background-color: #%06x%02x; }", color & 0xFFFFFF, (color >> 24) & 0xFF);
gtk_css_provider_load_from_string(css_provider, css_string);
g_free(css_string);
gtk_style_context_add_provider(gtk_widget_get_style_context(gtk_widget_get_parent(widget)), GTK_STYLE_PROVIDER(css_provider), GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
gtk_style_context_add_provider(gtk_widget_get_style_context(widget), GTK_STYLE_PROVIDER(css_provider), GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
}
JNIEXPORT void JNICALL Java_android_view_View_native_1setBackgroundDrawable(JNIEnv *env, jobject this, jlong widget_ptr, jlong paintable_ptr) {

View File

@@ -11,5 +11,5 @@ public class ColorDrawable extends Drawable {
public int getColor() {
return color;
}
}

View File

@@ -43,7 +43,7 @@ public class Drawable {
public ConstantState getConstantState() {
return null;
}
public abstract class ConstantState {
public abstract Drawable newDrawable(Resources res);
@@ -131,6 +131,9 @@ public class Drawable {
return drawable;
} else if ("transition".equals(parser.getName())) {
return new Drawable();
} else if ("ripple".equals(parser.getName())) {
// FIXME: the non-pressed state of RippleDrawable should be equivalent to this
return new ColorDrawable(0);
}
return null;
}

View File

@@ -12,5 +12,4 @@ public class RippleDrawable extends Drawable {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'draw'");
}
}