Merge "Do not run background animation without a Looper" into sc-dev
This commit is contained in:
commit
c359d54b49
@ -49,7 +49,9 @@ import android.graphics.RecordingCanvas;
|
||||
import android.graphics.Rect;
|
||||
import android.graphics.Shader;
|
||||
import android.os.Build;
|
||||
import android.os.Looper;
|
||||
import android.util.AttributeSet;
|
||||
import android.util.Log;
|
||||
import android.view.animation.AnimationUtils;
|
||||
import android.view.animation.LinearInterpolator;
|
||||
|
||||
@ -113,6 +115,7 @@ import java.util.Arrays;
|
||||
* @attr ref android.R.styleable#RippleDrawable_color
|
||||
*/
|
||||
public class RippleDrawable extends LayerDrawable {
|
||||
private static final String TAG = "RippleDrawable";
|
||||
/**
|
||||
* Radius value that specifies the ripple radius should be computed based
|
||||
* on the size of the ripple's container.
|
||||
@ -848,6 +851,10 @@ public class RippleDrawable extends LayerDrawable {
|
||||
|
||||
private void startBackgroundAnimation() {
|
||||
mRunBackgroundAnimation = false;
|
||||
if (Looper.myLooper() == null) {
|
||||
Log.w(TAG, "Thread doesn't have a looper. Skipping animation.");
|
||||
return;
|
||||
}
|
||||
mBackgroundAnimation = ValueAnimator.ofFloat(mBackgroundOpacity, mTargetBackgroundOpacity);
|
||||
mBackgroundAnimation.setInterpolator(LINEAR_INTERPOLATOR);
|
||||
mBackgroundAnimation.setDuration(BACKGROUND_OPACITY_DURATION);
|
||||
|
Loading…
x
Reference in New Issue
Block a user