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: add stubs / simple stuff for OsmAnd
without native libs present, launches and renders white square in map view; with native libs present, segfaults in bundled skia
This commit is contained in:
@@ -1,14 +1,16 @@
|
||||
package android.widget;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.util.AttributeSet;
|
||||
|
||||
public abstract class CompoundButton extends Button implements Checkable {
|
||||
Drawable button_drawable = null;
|
||||
|
||||
public CompoundButton(Context context) {
|
||||
super(context);
|
||||
}
|
||||
|
||||
|
||||
public CompoundButton(Context context, AttributeSet attributeSet) {
|
||||
super(context, attributeSet);
|
||||
}
|
||||
@@ -41,4 +43,12 @@ public abstract class CompoundButton extends Button implements Checkable {
|
||||
public void setTextColor(int color) {}
|
||||
@Override
|
||||
public void setTextSize(float size) {}
|
||||
|
||||
public void setButtonDrawable(Drawable drawable) {
|
||||
button_drawable = drawable;
|
||||
}
|
||||
|
||||
public Drawable getButtonDrawable() {
|
||||
return button_drawable;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@ import android.content.res.ColorStateList;
|
||||
import android.content.res.TypedArray;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.BitmapFactory;
|
||||
import android.graphics.Canvas;
|
||||
import android.graphics.Matrix;
|
||||
import android.graphics.PorterDuff;
|
||||
import android.graphics.drawable.BitmapDrawable;
|
||||
@@ -55,8 +56,15 @@ public class ImageView extends View {
|
||||
}
|
||||
|
||||
public Drawable getDrawable() {
|
||||
if(bitmap == null)
|
||||
return null;
|
||||
if(bitmap == null) {
|
||||
return new Drawable() {
|
||||
@Override
|
||||
public void draw(Canvas canvas) {
|
||||
// TODO Auto-generated method stub
|
||||
throw new UnsupportedOperationException("Unimplemented method 'draw'");
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
return new BitmapDrawable(getContext().getResources(), bitmap);
|
||||
}
|
||||
|
||||
@@ -23,4 +23,19 @@ public class ListView extends AbsListView {
|
||||
|
||||
public void addHeaderView(View v, Object data, boolean isSelectable) {}
|
||||
|
||||
public void setDrawSelectorOnTop(boolean dummy) {}
|
||||
|
||||
public void addHeaderView(View view) {}
|
||||
|
||||
public boolean removeHeaderView(View view) { return true; }
|
||||
|
||||
public int getHeaderViewsCount() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
public int getFooterViewsCount() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
public void setDivider(Drawable drawable) {}
|
||||
}
|
||||
|
||||
@@ -11,6 +11,7 @@ public class ProgressBar extends View {
|
||||
|
||||
protected int max = 100;
|
||||
protected int progress = 0;
|
||||
private boolean indeterminate = false;
|
||||
private Drawable indeterminateDrawable;
|
||||
|
||||
public ProgressBar(Context context, AttributeSet attrs, int defStyle) {
|
||||
@@ -43,7 +44,15 @@ public class ProgressBar extends View {
|
||||
protected native long native_constructor(Context context, AttributeSet attrs);
|
||||
protected native void native_setProgress(long widget, float fraction);
|
||||
|
||||
public native void setIndeterminate(boolean indeterminate);
|
||||
public boolean isIndeterminate() {
|
||||
return indeterminate;
|
||||
}
|
||||
|
||||
public void setIndeterminate(boolean indeterminate) {
|
||||
native_setIndeterminate(indeterminate);
|
||||
indeterminate = true;
|
||||
}
|
||||
|
||||
|
||||
public Drawable getProgressDrawable() {
|
||||
return new Drawable() {
|
||||
@@ -82,4 +91,9 @@ public class ProgressBar extends View {
|
||||
public void setIndeterminateDrawable(Drawable indeterminateDrawable) {
|
||||
this.indeterminateDrawable = indeterminateDrawable;
|
||||
}
|
||||
|
||||
public void setProgressDrawable(Drawable indeterminateDrawable) {
|
||||
}
|
||||
|
||||
public native void native_setIndeterminate(boolean indeterminate);
|
||||
}
|
||||
|
||||
@@ -4,6 +4,10 @@ import android.content.Context;
|
||||
|
||||
public class Toast {
|
||||
|
||||
public Toast(Context context) {
|
||||
/* TODO */
|
||||
}
|
||||
|
||||
private String text;
|
||||
|
||||
public static Toast makeText(Context context, int resId, int duration) {
|
||||
@@ -11,7 +15,7 @@ public class Toast {
|
||||
}
|
||||
|
||||
public static Toast makeText(Context context, CharSequence text, int duration) {
|
||||
Toast toast = new Toast();
|
||||
Toast toast = new Toast(context);
|
||||
toast.text = String.valueOf(text);
|
||||
return toast;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user