Add some missing APIs.

android.widget.Filter and android.webkit.MimeTypeMap are copied from
AOSP. Other new classes are only stub implementations.
This commit is contained in:
Julian Winkler
2023-09-01 12:55:04 +02:00
parent 6c2a3adae6
commit 97f8c2ed0f
30 changed files with 1165 additions and 38 deletions

View File

@@ -4,6 +4,7 @@ import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Matrix;
import android.graphics.PorterDuff;
import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.Drawable;
import android.util.AttributeSet;
@@ -12,6 +13,7 @@ import android.view.View;
public class ImageView extends View {
private Bitmap bitmap;
private ScaleType scaleType = ScaleType.FIT_CENTER;
public ImageView(Context context, AttributeSet attrs) {
super(context, attrs);
@@ -43,7 +45,13 @@ public class ImageView extends View {
}
public void setAdjustViewBounds(boolean adjustViewBounds) {}
public void setScaleType(ScaleType scaleType) {}
public void setScaleType(ScaleType scaleType) {
this.scaleType = scaleType;
}
public ScaleType getScaleType() {
return scaleType;
}
public Drawable getDrawable() {
return new BitmapDrawable(getContext().getResources(), bitmap);
@@ -53,6 +61,11 @@ public class ImageView extends View {
public void setImageMatrix(Matrix matrix) {}
public void setImageBitmap(Bitmap bitmap) {
if (bitmap != null)
native_setPixbuf(bitmap.pixbuf);
}
/**
* Options for scaling the bounds of an image to the bounds of this view.
*/
@@ -111,4 +124,6 @@ public class ImageView extends View {
}
final int nativeInt;
}
public final void setColorFilter(int color, PorterDuff.Mode mode) {}
}