Add some stubs needed by android material library

This commit is contained in:
Julian Winkler
2023-08-22 14:41:01 +02:00
parent ca975a0e7c
commit 960930a348
42 changed files with 428 additions and 19 deletions

View File

@@ -45,6 +45,30 @@ public class Color {
return color >>> 24;
}
/**
* Return the red component of a color int. This is the same as saying
* (color >> 16) & 0xFF
*/
public static int red(int color) {
return (color >> 16) & 0xFF;
}
/**
* Return the green component of a color int. This is the same as saying
* (color >> 8) & 0xFF
*/
public static int green(int color) {
return (color >> 8) & 0xFF;
}
/**
* Return the blue component of a color int. This is the same as saying
* color & 0xFF
*/
public static int blue(int color) {
return color & 0xFF;
}
/**
* Parse the color string, and return the corresponding color-int.
* If the string cannot be parsed, throws an IllegalArgumentException

View File

@@ -0,0 +1,5 @@
package android.graphics;
public class ColorFilter {
}

View File

@@ -245,7 +245,7 @@ public class Matrix {
* Set the matrix to identity
*/
public void reset() {
native_reset(native_instance);
// native_reset(native_instance);
}
/**
* Set the matrix to translate by (dx, dy).
@@ -386,7 +386,8 @@ public class Matrix {
* M' = S(sx, sy, px, py) * M
*/
public boolean postScale(float sx, float sy, float px, float py) {
return native_postScale(native_instance, sx, sy, px, py);
// return native_postScale(native_instance, sx, sy, px, py);
return true;
}
/**
* Postconcats the matrix with the specified scale.
@@ -480,7 +481,8 @@ public class Matrix {
if (dst == null || src == null) {
throw new NullPointerException();
}
return native_setRectToRect(native_instance, src, dst, stf.nativeInt);
// return native_setRectToRect(native_instance, src, dst, stf.nativeInt);
return true;
}
// private helper to perform range checks on arrays of "points"
private static void checkPointArrays(float[] src, int srcIndex,

View File

@@ -20,7 +20,7 @@ package android.graphics;
* A color filter that can be used to tint the source pixels using a single
* color and a specific {@link PorterDuff Porter-Duff composite mode}.
*/
public class PorterDuffColorFilter {
public class PorterDuffColorFilter extends ColorFilter {
private int mColor;
private PorterDuff.Mode mMode;

View File

@@ -36,4 +36,12 @@ public class Typeface {
public static Typeface createFromAsset(AssetManager mgr, String path) {
return null;
}
public static Typeface create(String familyName, int style) {
return null;
}
public static Typeface create(Typeface typeface, int style) {
return null;
}
}

View File

@@ -2,6 +2,7 @@ package android.graphics.drawable;
import android.content.res.Resources;
import android.graphics.Canvas;
import android.graphics.ColorFilter;
import android.graphics.PorterDuff;
import android.graphics.Rect;
@@ -65,8 +66,12 @@ public abstract class Drawable {
public void setBounds(Rect bounds) {}
public void setColorFilter(int color, PorterDuff.Mode mode) {}
public void setColorFilter(ColorFilter filter) {}
public Drawable mutate() {
return this;
}
public int getIntrinsicWidth() {return 0;}
public int getIntrinsicHeight() {return 0;}
}

View File

@@ -0,0 +1,17 @@
package android.graphics.drawable;
import android.graphics.Canvas;
public class InsetDrawable extends Drawable {
public InsetDrawable(Drawable drawable, int insetLeft, int insetTop, int insetRight, int insetBottom) {
super();
}
@Override
public void draw(Canvas canvas) {
// TODO Auto-generated method stub
throw new UnsupportedOperationException("Unimplemented method 'draw'");
}
}