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
api-impl: misc stubs and fixes for several apps including F-Droid and AuroraStore
This commit is contained in:
@@ -217,6 +217,10 @@ public final class Bitmap {
|
||||
|
||||
public void setPremultiplied(boolean premultiplied) {}
|
||||
|
||||
public Bitmap extractAlpha() {
|
||||
return this.copy(config, mutable);
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
@Override
|
||||
protected void finalize() throws Throwable {
|
||||
|
||||
@@ -482,6 +482,10 @@ public class Canvas {
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean clipRect(RectF rect, Region.Op op) {
|
||||
return false;
|
||||
}
|
||||
|
||||
public void drawArc(float left, float top, float right, float bottom, float startAngle, float sweepAngle, boolean includeCenter, Paint paint) {}
|
||||
|
||||
public void drawRoundRect(float left, float top, float right, float bottom, float rx, float ry, Paint paint) {}
|
||||
|
||||
@@ -158,4 +158,25 @@ public class Color {
|
||||
}
|
||||
hsv[2] = max;
|
||||
}
|
||||
|
||||
public static int HSVToColor(float[] hsv) {
|
||||
float h = hsv[0];
|
||||
float s = hsv[1];
|
||||
float v_ = hsv[2];
|
||||
int hi = (int)Math.floor(h / 60) % 6;
|
||||
float f = (h / 60 - (float)Math.floor(h / 60)) * 6;
|
||||
int p = (int)(v_ * (1 - s) * 255.f + 0.5f);
|
||||
int q = (int)(v_ * (1 - f * s) * 255.f + 0.5f);
|
||||
int t = (int)(v_ * (1 - (1 - f) * s) * 255.f + 0.5f);
|
||||
int v = (int)(v_ * 255.f + 0.5f);
|
||||
switch (hi) {
|
||||
case 0: return Color.rgb(v, t, p);
|
||||
case 1: return Color.rgb(q, v, p);
|
||||
case 2: return Color.rgb(p, v, t);
|
||||
case 3: return Color.rgb(p, q, v);
|
||||
case 4: return Color.rgb(t, p, v);
|
||||
case 5: return Color.rgb(v, p, q);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -53,7 +53,8 @@ public class GskCanvas extends Canvas {
|
||||
|
||||
@Override
|
||||
public void drawPath(Path path, Paint paint) {
|
||||
native_drawPath(snapshot, path.getGskPath(), paint != null ? paint.paint : default_paint.paint);
|
||||
if (path != null)
|
||||
native_drawPath(snapshot, path.getGskPath(), paint != null ? paint.paint : default_paint.paint);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -191,6 +191,12 @@ public class Path {
|
||||
addPath(src);
|
||||
}
|
||||
|
||||
public void offset(float dx, float dy) {
|
||||
Matrix matrix = new Matrix();
|
||||
matrix.setTranslate(dx, dy);
|
||||
transform(matrix);
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
@Override
|
||||
protected void finalize() throws Throwable {
|
||||
|
||||
@@ -24,6 +24,7 @@ import android.graphics.PorterDuff;
|
||||
import android.graphics.PorterDuffColorFilter;
|
||||
import android.graphics.Rect;
|
||||
import android.util.AttributeSet;
|
||||
import android.util.LayoutDirection;
|
||||
import android.util.TypedValue;
|
||||
|
||||
public class Drawable {
|
||||
@@ -323,6 +324,10 @@ public class Drawable {
|
||||
|
||||
public void setHotspot(float x, float y) {}
|
||||
|
||||
public int getLayoutDirection() {
|
||||
return LayoutDirection.LTR;
|
||||
}
|
||||
|
||||
protected static native long native_paintable_from_path(String path);
|
||||
protected native long native_constructor();
|
||||
protected native void native_invalidate(long paintable);
|
||||
|
||||
@@ -1,8 +1,14 @@
|
||||
package android.graphics.drawable;
|
||||
|
||||
import android.graphics.Bitmap;
|
||||
|
||||
public class Icon {
|
||||
|
||||
public static Icon createWithResource(String packageName, int resourceId) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public static Icon createWithBitmap(Bitmap bitmap) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user