- * For performance reasons, inflation relies heavily on pre-processing of
- * XML files that is done at build time. Therefore, it is not currently possible
- * to use this inflater with an XmlPullParser over a plain XML file at runtime;
- * it only works with an XmlPullParser returned from a compiled resource (R.
- * something file.)
- */
-public class AnimatorInflater {
- private static final String TAG = "AnimatorInflater";
- /**
- * These flags are used when parsing AnimatorSet objects
- */
- private static final int TOGETHER = 0;
- private static final int SEQUENTIALLY = 1;
-
- /**
- * Enum values used in XML attributes to indicate the value for mValueType
- */
- private static final int VALUE_TYPE_FLOAT = 0;
- private static final int VALUE_TYPE_INT = 1;
- private static final int VALUE_TYPE_PATH = 2;
- private static final int VALUE_TYPE_COLOR = 4;
- private static final int VALUE_TYPE_CUSTOM = 5;
-
- private static final boolean DBG_ANIMATOR_INFLATER = false;
-
- private static final ArgbEvaluator ARGB_EVALUATOR = new ArgbEvaluator();
-
- /**
- * Loads an {@link android.animation.Animator} object from a resource
- *
- * @param context Application context used to access resources
- * @param id The resource id of the animation to load
- * @return The animator object reference by the specified id
- * @throws android.content.res.Resources.NotFoundException when the animation cannot be loaded
- */
- public static Animator loadAnimator(Context context, int id)
- throws NotFoundException {
- return loadAnimator(context, id, 1);
- }
-
- public static Animator loadAnimator(Context context, int id, float pathErrorScale) {
- Resources resources = context.getResources();
- XmlResourceParser parser = null;
- try {
- parser = resources.getAnimation(id);
- return createAnimatorFromXml(context, parser, pathErrorScale);
- } catch (XmlPullParserException ex) {
- NotFoundException rnf =
- new NotFoundException("Can't load animation resource ID #0x" +
- Integer.toHexString(id));
- rnf.initCause(ex);
- throw rnf;
- } catch (IOException ex) {
- NotFoundException rnf =
- new NotFoundException("Can't load animation resource ID #0x" +
- Integer.toHexString(id));
- rnf.initCause(ex);
- throw rnf;
- } finally {
- if (parser != null) parser.close();
- }
- }
-
- /* TODO Not support StateListAnimator
- public static StateListAnimator loadStateListAnimator(Context context, int id)
- throws NotFoundException {
- XmlResourceParser parser = null;
- try {
- parser = context.getResources().getAnimation(id);
- return createStateListAnimatorFromXml(context, parser, Xml.asAttributeSet(parser));
- } catch (XmlPullParserException ex) {
- NotFoundException rnf =
- new NotFoundException(
- "Can't load state list animator resource ID #0x" +
- Integer.toHexString(id)
- );
- rnf.initCause(ex);
- throw rnf;
- } catch (IOException ex) {
- NotFoundException rnf =
- new NotFoundException(
- "Can't load state list animator resource ID #0x" +
- Integer.toHexString(id)
- );
- rnf.initCause(ex);
- throw rnf;
- } finally {
- if (parser != null) {
- parser.close();
- }
- }
- }
- */
-
- /* TODO Not support StateListAnimator
- private static StateListAnimator createStateListAnimatorFromXml(Context context,
- XmlPullParser parser, AttributeSet attributeSet)
- throws IOException, XmlPullParserException {
- int type;
- StateListAnimator stateListAnimator = new StateListAnimator();
-
- while (true) {
- type = parser.next();
- switch (type) {
- case XmlPullParser.END_DOCUMENT:
- case XmlPullParser.END_TAG:
- return stateListAnimator;
-
- case XmlPullParser.START_TAG:
- // parse item
- Animator animator = null;
- if ("item".equals(parser.getName())) {
- int attributeCount = parser.getAttributeCount();
- int[] states = new int[attributeCount];
- int stateIndex = 0;
- for (int i = 0; i < attributeCount; i++) {
- int attrName = attributeSet.getAttributeNameResource(i);
- if (attrName == R.attr.animation) {
- animator = loadAnimator(context,
- attributeSet.getAttributeResourceValue(i, 0));
- } else {
- states[stateIndex++] =
- attributeSet.getAttributeBooleanValue(i, false) ?
- attrName : -attrName;
- }
-
- }
- if (animator == null) {
- animator = createAnimatorFromXml(context, parser, 1f);
- }
-
- if (animator == null) {
- throw new NotFoundException(
- "animation state item must have a valid animation");
- }
- stateListAnimator
- .addState(StateSet.trimStateSet(states, stateIndex), animator);
-
- }
- break;
- }
- }
- }
- */
-
- /**
- * PathDataEvaluator is used to interpolate between two paths which are
- * represented in the same format but different control points' values.
- * The path is represented as an array of PathDataNode here, which is
- * fundamentally an array of floating point numbers.
- */
- private static class PathDataEvaluator implements TypeEvaluator The PathParser.PathDataNode[] will be allocated.
- */
- private PathDataEvaluator() {}
-
- /**
- * Create a PathDataEvaluator that reuses nodeArray for every evaluate() call.
- * Caution must be taken to ensure that the value returned from
- * {@link android.animation.ValueAnimator#getAnimatedValue()} is not cached, modified, or
- * used across threads. The value will be modified on each evaluate() call.
- *
- * @param nodeArray The array to modify and return from evaluate.
- */
- public PathDataEvaluator(PathParser.PathDataNode[] nodeArray) {
- mNodeArray = nodeArray;
- }
-
- @Override
- public PathParser.PathDataNode[] evaluate(float fraction,
- PathParser.PathDataNode[] startPathData,
- PathParser.PathDataNode[] endPathData) {
- if (!PathParser.canMorph(startPathData, endPathData)) {
- throw new IllegalArgumentException("Can't interpolate between"
- + " two incompatible pathData");
- }
-
- if (mNodeArray == null || !PathParser.canMorph(mNodeArray, startPathData)) {
- mNodeArray = PathParser.deepCopyNodes(startPathData);
- }
-
- for (int i = 0; i < startPathData.length; i++) {
- mNodeArray[i].interpolatePathDataNode(startPathData[i],
- endPathData[i], fraction);
- }
-
- return mNodeArray;
- }
- }
-
- /**
- * @param anim The animator, must not be null
- * @param arrayAnimator Incoming typed array for Animator's attributes.
- * @param arrayObjectAnimator Incoming typed array for Object Animator's
- * attributes.
- * @param pixelSize The relative pixel size, used to calculate the
- * maximum error for path animations.
- */
- private static void parseAnimatorFromTypeArray(ValueAnimator anim,
- TypedArray arrayAnimator, TypedArray arrayObjectAnimator, float pixelSize) {
- long duration = arrayAnimator.getInt(R.styleable.Animator_duration, 300);
-
- long startDelay = arrayAnimator.getInt(R.styleable.Animator_startOffset, 0);
-
- int valueType = arrayAnimator.getInt(R.styleable.Animator_valueType,
- VALUE_TYPE_FLOAT);
-
- TypeEvaluator evaluator = null;
-
- boolean getFloats = (valueType == VALUE_TYPE_FLOAT);
-
- TypedValue tvFrom = arrayAnimator.peekValue(R.styleable.Animator_valueFrom);
- boolean hasFrom = (tvFrom != null);
- int fromType = hasFrom ? tvFrom.type : 0;
- TypedValue tvTo = arrayAnimator.peekValue(R.styleable.Animator_valueTo);
- boolean hasTo = (tvTo != null);
- int toType = hasTo ? tvTo.type : 0;
-
- // TODO: Further clean up this part of code into 4 types : path, color,
- // integer and float.
- if (valueType == VALUE_TYPE_PATH) {
- evaluator = setupAnimatorForPath(anim, arrayAnimator);
- } else {
- // Integer and float value types are handled here.
- if ((hasFrom && (fromType >= TypedValue.TYPE_FIRST_COLOR_INT) &&
- (fromType <= TypedValue.TYPE_LAST_COLOR_INT)) ||
- (hasTo && (toType >= TypedValue.TYPE_FIRST_COLOR_INT) &&
- (toType <= TypedValue.TYPE_LAST_COLOR_INT))) {
- // special case for colors: ignore valueType and get ints
- getFloats = false;
- evaluator = ARGB_EVALUATOR;
- }
- setupValues(anim, arrayAnimator, getFloats, hasFrom, fromType, hasTo, toType);
- }
-
- anim.setDuration(duration);
- anim.setStartDelay(startDelay);
-
- if (arrayAnimator.hasValue(R.styleable.Animator_repeatCount)) {
- anim.setRepeatCount(
- arrayAnimator.getInt(R.styleable.Animator_repeatCount, 0));
- }
- if (arrayAnimator.hasValue(R.styleable.Animator_repeatMode)) {
- anim.setRepeatMode(
- arrayAnimator.getInt(R.styleable.Animator_repeatMode,
- ValueAnimator.RESTART));
- }
- if (evaluator != null) {
- anim.setEvaluator(evaluator);
- }
-
- if (arrayObjectAnimator != null) {
- setupObjectAnimator(anim, arrayObjectAnimator, getFloats, pixelSize);
- }
- }
-
- /**
- * Setup the Animator to achieve path morphing.
- *
- * @param anim The target Animator which will be updated.
- * @param arrayAnimator TypedArray for the ValueAnimator.
- * @return the PathDataEvaluator.
- */
- private static TypeEvaluator setupAnimatorForPath(ValueAnimator anim,
- TypedArray arrayAnimator) {
- TypeEvaluator evaluator = null;
- String fromString = arrayAnimator.getString(R.styleable.Animator_valueFrom);
- String toString = arrayAnimator.getString(R.styleable.Animator_valueTo);
- PathParser.PathDataNode[] nodesFrom = PathParser.createNodesFromPathData(fromString);
- PathParser.PathDataNode[] nodesTo = PathParser.createNodesFromPathData(toString);
-
- if (nodesFrom != null) {
- if (nodesTo != null) {
- anim.setObjectValues(nodesFrom, nodesTo);
- if (!PathParser.canMorph(nodesFrom, nodesTo)) {
- throw new InflateException(arrayAnimator.getPositionDescription()
- + " Can't morph from " + fromString + " to " + toString);
- }
- } else {
- anim.setObjectValues((Object)nodesFrom);
- }
- evaluator = new PathDataEvaluator(PathParser.deepCopyNodes(nodesFrom));
- } else if (nodesTo != null) {
- anim.setObjectValues((Object)nodesTo);
- evaluator = new PathDataEvaluator(PathParser.deepCopyNodes(nodesTo));
- }
-
- if (DBG_ANIMATOR_INFLATER && evaluator != null) {
- Log.v(TAG, "create a new PathDataEvaluator here");
- }
-
- return evaluator;
- }
-
- /**
- * Setup ObjectAnimator's property or values from pathData.
- *
- * @param anim The target Animator which will be updated.
- * @param arrayObjectAnimator TypedArray for the ObjectAnimator.
- * @param getFloats True if the value type is float.
- * @param pixelSize The relative pixel size, used to calculate the
- * maximum error for path animations.
- */
- private static void setupObjectAnimator(ValueAnimator anim, TypedArray arrayObjectAnimator,
- boolean getFloats, float pixelSize) {
- ObjectAnimator oa = (ObjectAnimator) anim;
- String pathData = arrayObjectAnimator.getString(R.styleable.PropertyAnimator_pathData);
-
- // Note that if there is a pathData defined in the Object Animator,
- // valueFrom / valueTo will be ignored.
- if (pathData != null) {
- throw new IllegalStateException("Not support PropertyAnimator_pathData");
- /* TODO Not support pathData
- String propertyXName =
- arrayObjectAnimator.getString(R.styleable.PropertyAnimator_propertyXName);
- String propertyYName =
- arrayObjectAnimator.getString(R.styleable.PropertyAnimator_propertyYName);
-
- if (propertyXName == null && propertyYName == null) {
- throw new InflateException(arrayObjectAnimator.getPositionDescription()
- + " propertyXName or propertyYName is needed for PathData");
- } else {
- JPath path = JPathParser.createPathFromPathData(pathData);
- float error = 0.5f * pixelSize; // max half a pixel error
- PathKeyframes keyframeSet = new PathKeyframes(path, error);
- Keyframes xKeyframes;
- Keyframes yKeyframes;
- if (getFloats) {
- xKeyframes = keyframeSet.createXFloatKeyframes();
- yKeyframes = keyframeSet.createYFloatKeyframes();
- } else {
- xKeyframes = keyframeSet.createXIntKeyframes();
- yKeyframes = keyframeSet.createYIntKeyframes();
- }
- PropertyValuesHolder x = null;
- PropertyValuesHolder y = null;
- if (propertyXName != null) {
- x = PropertyValuesHolder.ofKeyframes(propertyXName, xKeyframes);
- }
- if (propertyYName != null) {
- y = PropertyValuesHolder.ofKeyframes(propertyYName, yKeyframes);
- }
- if (x == null) {
- oa.setValues(y);
- } else if (y == null) {
- oa.setValues(x);
- } else {
- oa.setValues(x, y);
- }
- }
- */
- } else {
- String propertyName =
- arrayObjectAnimator.getString(R.styleable.PropertyAnimator_propertyName);
- oa.setPropertyName(propertyName);
- }
- }
-
- /**
- * Setup ValueAnimator's values.
- * This will handle all of the integer, float and color types.
- *
- * @param anim The target Animator which will be updated.
- * @param arrayAnimator TypedArray for the ValueAnimator.
- * @param getFloats True if the value type is float.
- * @param hasFrom True if "valueFrom" exists.
- * @param fromType The type of "valueFrom".
- * @param hasTo True if "valueTo" exists.
- * @param toType The type of "valueTo".
- */
- private static void setupValues(ValueAnimator anim, TypedArray arrayAnimator,
- boolean getFloats, boolean hasFrom, int fromType, boolean hasTo, int toType) {
- int valueFromIndex = R.styleable.Animator_valueFrom;
- int valueToIndex = R.styleable.Animator_valueTo;
- if (getFloats) {
- float valueFrom;
- float valueTo;
- if (hasFrom) {
- if (fromType == TypedValue.TYPE_DIMENSION) {
- valueFrom = arrayAnimator.getDimension(valueFromIndex, 0f);
- } else {
- valueFrom = arrayAnimator.getFloat(valueFromIndex, 0f);
- }
- if (hasTo) {
- if (toType == TypedValue.TYPE_DIMENSION) {
- valueTo = arrayAnimator.getDimension(valueToIndex, 0f);
- } else {
- valueTo = arrayAnimator.getFloat(valueToIndex, 0f);
- }
- anim.setFloatValues(valueFrom, valueTo);
- } else {
- anim.setFloatValues(valueFrom);
- }
- } else {
- if (toType == TypedValue.TYPE_DIMENSION) {
- valueTo = arrayAnimator.getDimension(valueToIndex, 0f);
- } else {
- valueTo = arrayAnimator.getFloat(valueToIndex, 0f);
- }
- anim.setFloatValues(valueTo);
- }
- } else {
- int valueFrom;
- int valueTo;
- if (hasFrom) {
- if (fromType == TypedValue.TYPE_DIMENSION) {
- valueFrom = (int) arrayAnimator.getDimension(valueFromIndex, 0f);
- } else if ((fromType >= TypedValue.TYPE_FIRST_COLOR_INT) &&
- (fromType <= TypedValue.TYPE_LAST_COLOR_INT)) {
- valueFrom = arrayAnimator.getColor(valueFromIndex, 0);
- } else {
- valueFrom = arrayAnimator.getInt(valueFromIndex, 0);
- }
- if (hasTo) {
- if (toType == TypedValue.TYPE_DIMENSION) {
- valueTo = (int) arrayAnimator.getDimension(valueToIndex, 0f);
- } else if ((toType >= TypedValue.TYPE_FIRST_COLOR_INT) &&
- (toType <= TypedValue.TYPE_LAST_COLOR_INT)) {
- valueTo = arrayAnimator.getColor(valueToIndex, 0);
- } else {
- valueTo = arrayAnimator.getInt(valueToIndex, 0);
- }
- anim.setIntValues(valueFrom, valueTo);
- } else {
- anim.setIntValues(valueFrom);
- }
- } else {
- if (hasTo) {
- if (toType == TypedValue.TYPE_DIMENSION) {
- valueTo = (int) arrayAnimator.getDimension(valueToIndex, 0f);
- } else if ((toType >= TypedValue.TYPE_FIRST_COLOR_INT) &&
- (toType <= TypedValue.TYPE_LAST_COLOR_INT)) {
- valueTo = arrayAnimator.getColor(valueToIndex, 0);
- } else {
- valueTo = arrayAnimator.getInt(valueToIndex, 0);
- }
- anim.setIntValues(valueTo);
- }
- }
- }
- }
-
- private static Animator createAnimatorFromXml(Context context, XmlPullParser parser,
- float pixelSize)
- throws XmlPullParserException, IOException {
- return createAnimatorFromXml(context, parser, Xml.asAttributeSet(parser), null, 0,
- pixelSize);
- }
-
- private static Animator createAnimatorFromXml(Context context, XmlPullParser parser,
- AttributeSet attrs, AnimatorSet parent, int sequenceOrdering, float pixelSize)
- throws XmlPullParserException, IOException {
-
- Animator anim = null;
- ArrayListPoint
- * (0, 0) to (1, 1). The x coordinate along the Path
- * is the input value and the output is the y coordinate of the line at that point.
- * This means that the Path must conform to a function y = f(x).
- *
- * Path must not have gaps in the x direction and must not
- * loop back on itself such that there can be two points sharing the same x coordinate.
- * It is alright to have a disjoint line in the vertical direction:
- * Path path = new Path();
- * path.lineTo(0.25f, 0.25f);
- * path.moveTo(0.25f, 0.5f);
- * path.lineTo(1f, 1f);
- *
Path. The Path
- * must begin at (0, 0) and end at (1, 1).
- *
- * @param path The Path to use to make the line representing the interpolator.
- */
- public PathInterpolator(Path path) {
- initPath(path);
- }
-
- /**
- * Create an interpolator for a quadratic Bezier curve. The end points
- * (0, 0) and (1, 1) are assumed.
- *
- * @param controlX The x coordinate of the quadratic Bezier control point.
- * @param controlY The y coordinate of the quadratic Bezier control point.
- */
- public PathInterpolator(float controlX, float controlY) {
- initQuad(controlX, controlY);
- }
-
- /**
- * Create an interpolator for a cubic Bezier curve. The end points
- * (0, 0) and (1, 1) are assumed.
- *
- * @param controlX1 The x coordinate of the first control point of the cubic Bezier.
- * @param controlY1 The y coordinate of the first control point of the cubic Bezier.
- * @param controlX2 The x coordinate of the second control point of the cubic Bezier.
- * @param controlY2 The y coordinate of the second control point of the cubic Bezier.
- */
- public PathInterpolator(float controlX1, float controlY1, float controlX2, float controlY2) {
- initCubic(controlX1, controlY1, controlX2, controlY2);
- }
-
- public PathInterpolator(Context context, AttributeSet attrs) {
- this(context.getResources(), context.getTheme(), attrs);
- }
-
- public PathInterpolator(Resources res, Theme theme, AttributeSet attrs) {
- TypedArray a;
- if (theme != null) {
- a = theme.obtainStyledAttributes(attrs, R.styleable.PathInterpolator, 0, 0);
- } else {
- a = res.obtainAttributes(attrs, R.styleable.PathInterpolator);
- }
- parseInterpolatorFromTypeArray(a);
- a.recycle();
- }
-
- private void parseInterpolatorFromTypeArray(TypedArray a) {
- // If there is pathData defined in the xml file, then the controls points
- // will be all coming from pathData.
- if (a.hasValue(R.styleable.PathInterpolator_pathData)) {
- String pathData = a.getString(R.styleable.PathInterpolator_pathData);
- Path path = PathParser.createPathFromPathData(pathData);
- if (path == null) {
- throw new InflateException("The path is null, which is created"
- + " from " + pathData);
- }
- initPath(path);
- } else {
- if (!a.hasValue(R.styleable.PathInterpolator_controlX1)) {
- throw new InflateException("pathInterpolator requires the controlX1 attribute");
- } else if (!a.hasValue(R.styleable.PathInterpolator_controlY1)) {
- throw new InflateException("pathInterpolator requires the controlY1 attribute");
- }
- float x1 = a.getFloat(R.styleable.PathInterpolator_controlX1, 0);
- float y1 = a.getFloat(R.styleable.PathInterpolator_controlY1, 0);
-
- boolean hasX2 = a.hasValue(R.styleable.PathInterpolator_controlX2);
- boolean hasY2 = a.hasValue(R.styleable.PathInterpolator_controlY2);
-
- if (hasX2 != hasY2) {
- throw new InflateException(
- "pathInterpolator requires both controlX2 and controlY2 for cubic Beziers.");
- }
-
- if (!hasX2) {
- initQuad(x1, y1);
- } else {
- float x2 = a.getFloat(R.styleable.PathInterpolator_controlX2, 0);
- float y2 = a.getFloat(R.styleable.PathInterpolator_controlY2, 0);
- initCubic(x1, y1, x2, y2);
- }
- }
- }
-
- private void initQuad(float controlX, float controlY) {
- Path path = new Path();
- path.moveTo(0, 0);
- path.quadTo(controlX, controlY, 1f, 1f);
- initPath(path);
- }
-
- private void initCubic(float x1, float y1, float x2, float y2) {
- Path path = new Path();
- path.moveTo(0, 0);
- path.cubicTo(x1, y1, x2, y2, 1f, 1f);
- initPath(path);
- }
-
- private void initPath(Path path) {
- final PathMeasure pathMeasure = new PathMeasure(path, false /* forceClosed */);
-
- final float pathLength = pathMeasure.getLength();
- final int numPoints = (int) (pathLength / PRECISION) + 1;
-
- mX = new float[numPoints];
- mY = new float[numPoints];
-
- final float[] position = new float[2];
- for (int i = 0; i < numPoints; ++i) {
- final float distance = (i * pathLength) / (numPoints - 1);
- pathMeasure.getPosTan(distance, position, null /* tangent */);
-
- mX[i] = position[0];
- mY[i] = position[1];
- }
- }
-
- /**
- * Using the line in the Path in this interpolator that can be described as
- * y = f(x), finds the y coordinate of the line given t
- * as the x coordinate. Values less than 0 will always return 0 and values greater
- * than 1 will always return 1.
- *
- * @param t Treated as the x coordinate along the line.
- * @return The y coordinate of the Path along the line where x = t.
- * @see Interpolator#getInterpolation(float)
- */
- @Override
- public float getInterpolation(float t) {
- if (t <= 0) {
- return 0;
- } else if (t >= 1) {
- return 1;
- }
- // Do a binary search for the correct x to interpolate between.
- int startIndex = 0;
- int endIndex = mX.length - 1;
-
- while (endIndex - startIndex > 1) {
- int midIndex = (startIndex + endIndex) / 2;
- if (t < mX[midIndex]) {
- endIndex = midIndex;
- } else {
- startIndex = midIndex;
- }
- }
-
- float xRange = mX[endIndex] - mX[startIndex];
- if (xRange == 0) {
- return mY[startIndex];
- }
-
- float tInRange = t - mX[startIndex];
- float fraction = tInRange / xRange;
-
- float startY = mY[startIndex];
- float endY = mY[endIndex];
- return startY + (fraction * (endY - startY));
- }
-}
diff --git a/app/src/main/java/com/hippo/vectorold/content/VectorContext.java b/app/src/main/java/com/hippo/vectorold/content/VectorContext.java
deleted file mode 100644
index 0bc1ab2d2..000000000
--- a/app/src/main/java/com/hippo/vectorold/content/VectorContext.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * Copyright (C) 2015 Hippo Seven
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.hippo.vectorold.content;
-
-import android.content.Context;
-import android.content.ContextWrapper;
-import android.content.res.Resources;
-import android.content.res.VectorResources;
-import android.os.Build;
-
-public class VectorContext extends ContextWrapper {
-
- private VectorResources mVectorResources;
-
- public VectorContext(Context base) {
- super(base);
- }
-
- @Override
- public Resources getResources() {
- final Resources superResources = super.getResources();
- if (mVectorResources == null || mVectorResources.isBase(superResources)) {
- mVectorResources = new VectorResources(this, superResources);
- }
- return mVectorResources;
- }
-
- /**
- * In {@link android.content.ContextWrapper#attachBaseContext(Context)},
- * do super.attachBaseContext(Vector.wrapContext(newBase));.
- *
- * @param context the context
- * @return new context
- */
- public static Context wrapContext(Context context) {
- return Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP ? new VectorContext(context) : context;
- }
-}
diff --git a/app/src/main/java/com/hippo/vectorold/drawable/AnimatedVectorDrawable.java b/app/src/main/java/com/hippo/vectorold/drawable/AnimatedVectorDrawable.java
deleted file mode 100644
index f69194055..000000000
--- a/app/src/main/java/com/hippo/vectorold/drawable/AnimatedVectorDrawable.java
+++ /dev/null
@@ -1,430 +0,0 @@
-/*
- * Copyright (C) 2014 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
- * in compliance with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- */
-
-package com.hippo.vectorold.drawable;
-
-import android.animation.Animator;
-import android.content.Context;
-import android.content.res.ColorStateList;
-import android.content.res.Resources;
-import android.content.res.TypedArray;
-import android.graphics.Canvas;
-import android.graphics.ColorFilter;
-import android.graphics.PorterDuff;
-import android.graphics.Rect;
-import android.graphics.drawable.Animatable;
-import android.graphics.drawable.Drawable;
-import android.support.v4.util.ArrayMap;
-import android.util.AttributeSet;
-import android.util.Log;
-
-import com.hippo.vectorold.animation.AnimatorInflater;
-import com.hippo.ehviewer.R;
-
-import org.xmlpull.v1.XmlPullParser;
-import org.xmlpull.v1.XmlPullParserException;
-
-import java.io.IOException;
-import java.util.ArrayList;
-
-/**
- * This class uses {@link android.animation.ObjectAnimator} and
- * {@link android.animation.AnimatorSet} to animate the properties of a
- * {@link android.graphics.drawable.VectorDrawable} to create an animated drawable.
- * - * AnimatedVectorDrawable are normally defined as 3 separate XML files. - *
- *- * First is the XML file for {@link android.graphics.drawable.VectorDrawable}. - * Note that we allow the animation happen on the group's attributes and path's - * attributes, which requires they are uniquely named in this xml file. Groups - * and paths without animations do not need names. - *
- *- * <vector xmlns:android="http://schemas.android.com/apk/res/android" - * android:height="64dp" - * android:width="64dp" - * android:viewportHeight="600" - * android:viewportWidth="600" > - * <group - * android:name="rotationGroup" - * android:pivotX="300.0" - * android:pivotY="300.0" - * android:rotation="45.0" > - * <path - * android:name="v" - * android:fillColor="#000000" - * android:pathData="M300,70 l 0,-70 70,70 0,0 -70,70z" /> - * </group> - * </vector> - *
- * Second is the AnimatedVectorDrawable's xml file, which defines the target - * VectorDrawable, the target paths and groups to animate, the properties of the - * path and group to animate and the animations defined as the ObjectAnimators - * or AnimatorSets. - *
- *- * <animated-vector xmlns:android="http://schemas.android.com/apk/res/android" - * android:drawable="@drawable/vectordrawable" > - * <target - * android:name="rotationGroup" - * android:animation="@anim/rotation" /> - * <target - * android:name="v" - * android:animation="@anim/path_morph" /> - * </animated-vector> - *
- * Last is the Animator xml file, which is the same as a normal ObjectAnimator - * or AnimatorSet. - * To complete this example, here are the 2 animator files used in avd.xml: - * rotation.xml and path_morph.xml. - *
- *- * <objectAnimator - * android:duration="6000" - * android:propertyName="rotation" - * android:valueFrom="0" - * android:valueTo="360" /> - *
- * <set xmlns:android="http://schemas.android.com/apk/res/android"> - * <objectAnimator - * android:duration="3000" - * android:propertyName="pathData" - * android:valueFrom="M300,70 l 0,-70 70,70 0,0 -70,70z" - * android:valueTo="M300,70 l 0,-70 70,0 0,140 -70,0 z" - * android:valueType="pathType"/> - * </set> - *
- * NOTE: Only works of all animations are ValueAnimators.
- * @hide
- */
- /*
- public void reverse() {
- final ArrayList