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
Drawable: stub 'ripple' as transparent ColorDrawable, fix view.setBackgroundColor for buttons
This commit is contained in:
@@ -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) {
|
||||
|
||||
@@ -11,5 +11,5 @@ public class ColorDrawable extends Drawable {
|
||||
public int getColor() {
|
||||
return color;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -12,5 +12,4 @@ public class RippleDrawable extends Drawable {
|
||||
// TODO Auto-generated method stub
|
||||
throw new UnsupportedOperationException("Unimplemented method 'draw'");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user