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 to make AnimationDrawable and Animation not cause lockups
apps may (ab)use AnimationDrawable.run and Animation.setAnimationListener to time transitions between states; even though we don't currently implement the animations, state transitions are still desirable (otherwise the app may lock up)
This commit is contained in:
@@ -1,7 +1,21 @@
|
||||
package android.graphics.drawable;
|
||||
|
||||
public class AnimationDrawable extends Drawable {
|
||||
public void addFrame(Drawable drawable, int dummy) {}
|
||||
public void start() {}
|
||||
private int num_frames = 0;
|
||||
|
||||
public int getNumberOfFrames() {
|
||||
return num_frames;
|
||||
}
|
||||
|
||||
public void addFrame(Drawable drawable, int duration) {
|
||||
num_frames++;
|
||||
}
|
||||
public void start() {
|
||||
for(int i = 0; i < num_frames; i++) {
|
||||
run();
|
||||
}
|
||||
}
|
||||
public void stop() {}
|
||||
|
||||
public void run() {}
|
||||
}
|
||||
|
||||
@@ -35,6 +35,10 @@ public class SensorManager {
|
||||
}
|
||||
}
|
||||
|
||||
public void unregisterListener(final SensorEventListener listener) {
|
||||
unregisterListener(listener, null);
|
||||
}
|
||||
|
||||
public void unregisterListener(final SensorEventListener listener, Sensor sensor) {
|
||||
System.out.println("STUB: andoroid.hw.SensorManager.unregisterListener");
|
||||
}
|
||||
|
||||
@@ -2,7 +2,11 @@ package android.view.animation;
|
||||
|
||||
public class Animation {
|
||||
|
||||
public interface AnimationListener {}
|
||||
public interface AnimationListener {
|
||||
public void onAnimationEnd(Animation animation);
|
||||
public void onAnimationRepeat(Animation animation);
|
||||
public void onAnimationStart(Animation animation);
|
||||
}
|
||||
|
||||
public void setDuration(long durationMillis) {}
|
||||
|
||||
@@ -12,4 +16,10 @@ public class Animation {
|
||||
|
||||
public void setFillBefore(boolean dummy) {}
|
||||
public void setFillAfter(boolean dummy) {}
|
||||
|
||||
public void setStartOffset(long offset) {}
|
||||
|
||||
public void setAnimationListener(AnimationListener l) {
|
||||
l.onAnimationEnd(this); // FIXME
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,7 +13,7 @@ import android.view.View;
|
||||
|
||||
public class ImageView extends View {
|
||||
|
||||
private Bitmap bitmap;
|
||||
private Bitmap bitmap = null;
|
||||
private ScaleType scaleType = ScaleType.FIT_CENTER;
|
||||
|
||||
public ImageView(Context context, AttributeSet attrs) {
|
||||
@@ -61,6 +61,9 @@ public class ImageView extends View {
|
||||
}
|
||||
|
||||
public Drawable getDrawable() {
|
||||
if(bitmap == null)
|
||||
return null;
|
||||
|
||||
return new BitmapDrawable(getContext().getResources(), bitmap);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user