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
add support for custom Java Drawables
This is made possible, by adding a second Canvas implementation which can be used to render directly to GdkSnapshot objects For now the only implemented method is drawBitmap(), this is already enough to make VectorDrawableCompat functional
This commit is contained in:
@@ -28,7 +28,9 @@ public class Drawable {
|
||||
private int[] mStateSet = new int[0];
|
||||
public long paintable;
|
||||
|
||||
public Drawable() {}
|
||||
public Drawable() {
|
||||
this.paintable = native_constructor();
|
||||
}
|
||||
|
||||
public Drawable(long paintable) {
|
||||
this.paintable = paintable;
|
||||
@@ -180,4 +182,5 @@ public class Drawable {
|
||||
}
|
||||
|
||||
protected static native long native_paintable_from_path(String path);
|
||||
protected native long native_constructor();
|
||||
}
|
||||
|
||||
@@ -1,15 +1,7 @@
|
||||
package android.graphics.drawable;
|
||||
|
||||
import android.graphics.Canvas;
|
||||
|
||||
public class GradientDrawable extends Drawable {
|
||||
|
||||
@Override
|
||||
public void draw(Canvas canvas) {
|
||||
// TODO Auto-generated method stub
|
||||
throw new UnsupportedOperationException("Unimplemented method 'draw'");
|
||||
}
|
||||
|
||||
public void setColor(int color) {}
|
||||
|
||||
public void setCornerRadius(float cornerRadius) {}
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
package android.graphics.drawable;
|
||||
|
||||
import android.graphics.Canvas;
|
||||
import android.graphics.Rect;
|
||||
|
||||
public class InsetDrawable extends Drawable {
|
||||
@@ -9,12 +8,6 @@ public class InsetDrawable extends Drawable {
|
||||
super();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void draw(Canvas canvas) {
|
||||
// TODO Auto-generated method stub
|
||||
throw new UnsupportedOperationException("Unimplemented method 'draw'");
|
||||
}
|
||||
|
||||
public boolean getPadding(Rect padding) { return false; }
|
||||
|
||||
}
|
||||
|
||||
@@ -1,15 +1,9 @@
|
||||
package android.graphics.drawable;
|
||||
|
||||
import android.content.res.ColorStateList;
|
||||
import android.graphics.Canvas;
|
||||
|
||||
public class RippleDrawable extends Drawable {
|
||||
|
||||
public RippleDrawable(ColorStateList colorStateList, Drawable drawable, Drawable drawable2) {}
|
||||
|
||||
@Override
|
||||
public void draw(Canvas canvas) {
|
||||
// TODO Auto-generated method stub
|
||||
throw new UnsupportedOperationException("Unimplemented method 'draw'");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
package android.graphics.drawable;
|
||||
|
||||
import android.graphics.Canvas;
|
||||
import android.graphics.Paint;
|
||||
import android.graphics.drawable.shapes.Shape;
|
||||
|
||||
@@ -9,11 +8,5 @@ public class ShapeDrawable extends Drawable {
|
||||
public ShapeDrawable(Shape shape) {}
|
||||
|
||||
public Paint getPaint() {return new Paint();}
|
||||
|
||||
@Override
|
||||
public void draw(Canvas canvas) {
|
||||
// TODO Auto-generated method stub
|
||||
throw new UnsupportedOperationException("Unimplemented method 'draw'");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user