From ddbbb8ae8561c9e61becd03faa40997d76ab5a51 Mon Sep 17 00:00:00 2001 From: ztenghui Date: Tue, 6 May 2014 11:07:37 -0700 Subject: [PATCH] Further cleaning on animated part of VectorDrawable. State changed support is gone. Rename VAnimatedPath. Remove the obsolete documents. Update the tests to reflect the API changes. Change-Id: Icdc19c6519a4e29975877c1d167e61c8fa14a371 --- api/current.txt | 106 ++- .../res/drawable/btn_check_quantum_anim.xml | 46 -- core/res/res/values/attrs.xml | 68 -- core/res/res/values/public.xml | 6 - .../graphics/drawable/VectorDrawable.java | 782 +----------------- .../res/drawable/vector_drawable01.xml | 46 +- .../res/drawable/vector_drawable02.xml | 9 - .../res/drawable/vector_drawable03.xml | 63 -- .../res/drawable/vector_drawable04.xml | 58 -- .../res/drawable/vector_drawable05.xml | 91 -- .../res/drawable/vector_drawable06.xml | 28 - .../res/drawable/vector_drawable07.xml | 15 +- .../res/drawable/vector_drawable08.xml | 14 - .../res/drawable/vector_drawable09.xml | 8 - .../res/drawable/vector_drawable10.xml | 71 +- .../res/drawable/vector_drawable11.xml | 20 - .../res/drawable/vector_drawable12.xml | 43 - .../res/drawable/vector_drawable13.xml | 35 - .../res/drawable/vector_drawable14.xml | 13 - .../res/drawable/vector_drawable15.xml | 10 - .../res/drawable/vector_drawable16.xml | 9 - .../res/drawable/vector_drawable17.xml | 11 - .../res/drawable/vector_drawable18.xml | 10 +- .../res/drawable/vector_drawable19.xml | 9 - 24 files changed, 78 insertions(+), 1493 deletions(-) diff --git a/api/current.txt b/api/current.txt index 9cc011ce992ec..d96ab71914dd2 100644 --- a/api/current.txt +++ b/api/current.txt @@ -250,7 +250,7 @@ package android { field public static final int actionBarTabBarStyle = 16843508; // 0x10102f4 field public static final int actionBarTabStyle = 16843507; // 0x10102f3 field public static final int actionBarTabTextStyle = 16843509; // 0x10102f5 - field public static final int actionBarTheme = 16843837; // 0x101043d + field public static final int actionBarTheme = 16843831; // 0x1010437 field public static final int actionBarWidgetTheme = 16843671; // 0x1010397 field public static final int actionButtonStyle = 16843480; // 0x10102d8 field public static final int actionDropDownStyle = 16843479; // 0x10102d7 @@ -267,7 +267,7 @@ package android { field public static final int actionModeSplitBackground = 16843677; // 0x101039d field public static final int actionModeStyle = 16843668; // 0x1010394 field public static final int actionOverflowButtonStyle = 16843510; // 0x10102f6 - field public static final int actionOverflowMenuStyle = 16843857; // 0x1010451 + field public static final int actionOverflowMenuStyle = 16843851; // 0x101044b field public static final int actionProviderClass = 16843657; // 0x1010389 field public static final int actionViewClass = 16843516; // 0x10102fc field public static final int activatedBackgroundIndicator = 16843517; // 0x10102fd @@ -295,7 +295,6 @@ package android { field public static final int alwaysDrawnWithCache = 16842991; // 0x10100ef field public static final int alwaysRetainTaskState = 16843267; // 0x1010203 field public static final int angle = 16843168; // 0x10101a0 - field public static final int animate = 16843823; // 0x101042f field public static final int animateFirstView = 16843477; // 0x10102d5 field public static final int animateLayoutChanges = 16843506; // 0x10102f2 field public static final int animateOnClick = 16843356; // 0x101025c @@ -314,7 +313,7 @@ package android { field public static final int autoCompleteTextViewStyle = 16842859; // 0x101006b field public static final int autoLink = 16842928; // 0x10100b0 field public static final int autoMirrored = 16843754; // 0x10103ea - field public static final int autoRemoveFromRecents = 16843859; // 0x1010453 + field public static final int autoRemoveFromRecents = 16843853; // 0x101044d field public static final int autoStart = 16843445; // 0x10102b5 field public static final deprecated int autoText = 16843114; // 0x101016a field public static final int autoUrlDetect = 16843404; // 0x101028c @@ -383,29 +382,29 @@ package android { field public static final int clipChildren = 16842986; // 0x10100ea field public static final int clipOrientation = 16843274; // 0x101020a field public static final int clipToPadding = 16842987; // 0x10100eb - field public static final int clipToPath = 16843822; // 0x101042e + field public static final int clipToPath = 16843818; // 0x101042a field public static final int codes = 16843330; // 0x1010242 field public static final int collapseColumns = 16843083; // 0x101014b field public static final int color = 16843173; // 0x10101a5 - field public static final int colorAccent = 16843842; // 0x1010442 + field public static final int colorAccent = 16843836; // 0x101043c field public static final int colorActivatedHighlight = 16843664; // 0x1010390 field public static final int colorBackground = 16842801; // 0x1010031 field public static final int colorBackgroundCacheHint = 16843435; // 0x10102ab - field public static final int colorButtonNormal = 16843829; // 0x1010435 - field public static final int colorButtonNormalColored = 16843831; // 0x1010437 - field public static final int colorButtonPressed = 16843830; // 0x1010436 - field public static final int colorButtonPressedColored = 16843832; // 0x1010438 - field public static final int colorControlActivated = 16843828; // 0x1010434 - field public static final int colorControlNormal = 16843827; // 0x1010433 + field public static final int colorButtonNormal = 16843823; // 0x101042f + field public static final int colorButtonNormalColored = 16843825; // 0x1010431 + field public static final int colorButtonPressed = 16843824; // 0x1010430 + field public static final int colorButtonPressedColored = 16843826; // 0x1010432 + field public static final int colorControlActivated = 16843822; // 0x101042e + field public static final int colorControlNormal = 16843821; // 0x101042d field public static final int colorFocusedHighlight = 16843663; // 0x101038f field public static final int colorForeground = 16842800; // 0x1010030 field public static final int colorForegroundInverse = 16843270; // 0x1010206 field public static final int colorLongPressedHighlight = 16843662; // 0x101038e field public static final int colorMultiSelectHighlight = 16843665; // 0x1010391 field public static final int colorPressedHighlight = 16843661; // 0x101038d - field public static final int colorPrimary = 16843840; // 0x1010440 - field public static final int colorPrimaryDark = 16843841; // 0x1010441 - field public static final int colorPrimaryLight = 16843839; // 0x101043f + field public static final int colorPrimary = 16843834; // 0x101043a + field public static final int colorPrimaryDark = 16843835; // 0x101043b + field public static final int colorPrimaryLight = 16843833; // 0x1010439 field public static final int columnCount = 16843639; // 0x1010377 field public static final int columnDelay = 16843215; // 0x10101cf field public static final int columnOrderPreserved = 16843640; // 0x1010378 @@ -464,7 +463,7 @@ package android { field public static final int dividerHorizontal = 16843564; // 0x101032c field public static final int dividerPadding = 16843562; // 0x101032a field public static final int dividerVertical = 16843530; // 0x101030a - field public static final int documentLaunchMode = 16843858; // 0x1010452 + field public static final int documentLaunchMode = 16843852; // 0x101044c field public static final int drawSelectorOnTop = 16843004; // 0x10100fc field public static final int drawable = 16843161; // 0x1010199 field public static final int drawableBottom = 16843118; // 0x101016e @@ -487,14 +486,13 @@ package android { field public static final int dropDownWidth = 16843362; // 0x1010262 field public static final int duplicateParentState = 16842985; // 0x10100e9 field public static final int duration = 16843160; // 0x1010198 - field public static final int durations = 16843814; // 0x1010426 field public static final int editTextBackground = 16843602; // 0x1010352 field public static final int editTextColor = 16843601; // 0x1010351 field public static final int editTextPreferenceStyle = 16842898; // 0x1010092 field public static final int editTextStyle = 16842862; // 0x101006e field public static final deprecated int editable = 16843115; // 0x101016b field public static final int editorExtras = 16843300; // 0x1010224 - field public static final int elevation = 16843853; // 0x101044d + field public static final int elevation = 16843847; // 0x1010447 field public static final int ellipsize = 16842923; // 0x10100ab field public static final int ems = 16843096; // 0x1010158 field public static final int enabled = 16842766; // 0x101000e @@ -504,9 +502,9 @@ package android { field public static final int entries = 16842930; // 0x10100b2 field public static final int entryValues = 16843256; // 0x10101f8 field public static final int eventsInterceptionEnabled = 16843389; // 0x101027d - field public static final int excludeClass = 16843855; // 0x101044f + field public static final int excludeClass = 16843849; // 0x1010449 field public static final int excludeFromRecents = 16842775; // 0x1010017 - field public static final int excludeId = 16843854; // 0x101044e + field public static final int excludeId = 16843848; // 0x1010448 field public static final int exitFadeDuration = 16843533; // 0x101030d field public static final int expandableListPreferredChildIndicatorLeft = 16842834; // 0x1010052 field public static final int expandableListPreferredChildIndicatorRight = 16842835; // 0x1010053 @@ -535,11 +533,11 @@ package android { field public static final int fastScrollTextColor = 16843609; // 0x1010359 field public static final int fastScrollThumbDrawable = 16843574; // 0x1010336 field public static final int fastScrollTrackDrawable = 16843577; // 0x1010339 - field public static final int fill = 16843809; // 0x1010421 + field public static final int fill = 16843808; // 0x1010420 field public static final int fillAfter = 16843197; // 0x10101bd field public static final int fillBefore = 16843196; // 0x10101bc field public static final int fillEnabled = 16843343; // 0x101024f - field public static final int fillOpacity = 16843808; // 0x1010420 + field public static final int fillOpacity = 16843807; // 0x101041f field public static final int fillViewport = 16843130; // 0x101017a field public static final int filter = 16843035; // 0x101011b field public static final int filterTouchesWhenObscured = 16843460; // 0x10102c4 @@ -601,7 +599,7 @@ package android { field public static final int headerBackground = 16843055; // 0x101012f field public static final int headerDividersEnabled = 16843310; // 0x101022e field public static final int height = 16843093; // 0x1010155 - field public static final int hideOnContentScroll = 16843856; // 0x1010450 + field public static final int hideOnContentScroll = 16843850; // 0x101044a field public static final int hint = 16843088; // 0x1010150 field public static final int homeAsUpIndicator = 16843531; // 0x101030b field public static final int homeLayout = 16843549; // 0x101031d @@ -771,7 +769,6 @@ package android { field public static final int layout_x = 16843135; // 0x101017f field public static final int layout_y = 16843136; // 0x1010180 field public static final int left = 16843181; // 0x10101ad - field public static final int limitTo = 16843824; // 0x1010430 field public static final int lineSpacingExtra = 16843287; // 0x1010217 field public static final int lineSpacingMultiplier = 16843288; // 0x1010218 field public static final int lines = 16843092; // 0x1010154 @@ -833,7 +830,7 @@ package android { field public static final int name = 16842755; // 0x1010003 field public static final int navigationMode = 16843471; // 0x10102cf field public static final int negativeButtonText = 16843254; // 0x10101f6 - field public static final int nestedScrollingEnabled = 16843843; // 0x1010443 + field public static final int nestedScrollingEnabled = 16843837; // 0x101043d field public static final int nextFocusDown = 16842980; // 0x10100e4 field public static final int nextFocusForward = 16843580; // 0x101033c field public static final int nextFocusLeft = 16842977; // 0x10100e1 @@ -875,18 +872,18 @@ package android { field public static final int parentActivityName = 16843687; // 0x10103a7 field public static final deprecated int password = 16843100; // 0x101015c field public static final int path = 16842794; // 0x101002a - field public static final int pathData = 16843810; // 0x1010422 + field public static final int pathData = 16843809; // 0x1010421 field public static final int pathPattern = 16842796; // 0x101002c field public static final int pathPrefix = 16842795; // 0x101002b field public static final int permission = 16842758; // 0x1010006 field public static final int permissionFlags = 16843719; // 0x10103c7 field public static final int permissionGroup = 16842762; // 0x101000a field public static final int permissionGroupFlags = 16843717; // 0x10103c5 - field public static final int persistable = 16843833; // 0x1010439 + field public static final int persistable = 16843827; // 0x1010433 field public static final int persistent = 16842765; // 0x101000d field public static final int persistentDrawingCache = 16842990; // 0x10100ee field public static final deprecated int phoneNumber = 16843111; // 0x1010167 - field public static final int pinned = 16843826; // 0x1010432 + field public static final int pinned = 16843820; // 0x101042c field public static final int pivotX = 16843189; // 0x10101b5 field public static final int pivotY = 16843190; // 0x10101b6 field public static final int popupAnimationStyle = 16843465; // 0x10102c9 @@ -941,7 +938,6 @@ package android { field public static final int readPermission = 16842759; // 0x1010007 field public static final int repeatCount = 16843199; // 0x10101bf field public static final int repeatMode = 16843200; // 0x10101c0 - field public static final int repeatStyle = 16843816; // 0x1010428 field public static final int reqFiveWayNav = 16843314; // 0x1010232 field public static final int reqHardKeyboard = 16843305; // 0x1010229 field public static final int reqKeyboardType = 16843304; // 0x1010228 @@ -951,7 +947,7 @@ package android { field public static final int required = 16843406; // 0x101028e field public static final int requiredAccountType = 16843734; // 0x10103d6 field public static final int requiredForAllUsers = 16843728; // 0x10103d0 - field public static final int requiredForProfile = 16843825; // 0x1010431 + field public static final int requiredForProfile = 16843819; // 0x101042b field public static final int requiresFadingEdge = 16843685; // 0x10103a5 field public static final int requiresSmallestWidthDp = 16843620; // 0x1010364 field public static final int resizeMode = 16843619; // 0x1010363 @@ -1015,8 +1011,7 @@ package android { field public static final int selectableItemBackground = 16843534; // 0x101030e field public static final int selectedDateVerticalBar = 16843591; // 0x1010347 field public static final int selectedWeekBackgroundColor = 16843586; // 0x1010342 - field public static final int sequence = 16843815; // 0x1010427 - field public static final int sessionService = 16843850; // 0x101044a + field public static final int sessionService = 16843844; // 0x1010444 field public static final int settingsActivity = 16843301; // 0x1010225 field public static final int shadowColor = 16843105; // 0x1010161 field public static final int shadowDx = 16843106; // 0x1010162 @@ -1038,7 +1033,7 @@ package android { field public static final int shrinkColumns = 16843082; // 0x101014a field public static final deprecated int singleLine = 16843101; // 0x101015d field public static final int singleUser = 16843711; // 0x10103bf - field public static final int slideEdge = 16843836; // 0x101043c + field public static final int slideEdge = 16843830; // 0x1010436 field public static final int smallIcon = 16843422; // 0x101029e field public static final int smallScreens = 16843396; // 0x1010284 field public static final int smoothScrollbar = 16843313; // 0x1010231 @@ -1055,13 +1050,13 @@ package android { field public static final int sspPattern = 16843749; // 0x10103e5 field public static final int sspPrefix = 16843748; // 0x10103e4 field public static final int stackFromBottom = 16843005; // 0x10100fd - field public static final int stackViewStyle = 16843851; // 0x101044b + field public static final int stackViewStyle = 16843845; // 0x1010445 field public static final int starStyle = 16842882; // 0x1010082 field public static final int startColor = 16843165; // 0x101019d field public static final int startDelay = 16843746; // 0x10103e2 field public static final int startOffset = 16843198; // 0x10101be field public static final deprecated int startYear = 16843132; // 0x101017c - field public static final int stateListAnimator = 16843860; // 0x1010454 + field public static final int stateListAnimator = 16843854; // 0x101044e field public static final int stateNotNeeded = 16842774; // 0x1010016 field public static final int state_above_anchor = 16842922; // 0x10100aa field public static final int state_accelerated = 16843547; // 0x101031b @@ -1091,13 +1086,13 @@ package android { field public static final int streamType = 16843273; // 0x1010209 field public static final int stretchColumns = 16843081; // 0x1010149 field public static final int stretchMode = 16843030; // 0x1010116 - field public static final int stroke = 16843811; // 0x1010423 - field public static final int strokeLineCap = 16843820; // 0x101042c - field public static final int strokeLineJoin = 16843821; // 0x101042d - field public static final int strokeOpacity = 16843812; // 0x1010424 - field public static final int strokeWidth = 16843813; // 0x1010425 + field public static final int stroke = 16843810; // 0x1010422 + field public static final int strokeLineCap = 16843816; // 0x1010428 + field public static final int strokeLineJoin = 16843817; // 0x1010429 + field public static final int strokeOpacity = 16843811; // 0x1010423 + field public static final int strokeWidth = 16843812; // 0x1010424 field public static final int subtitle = 16843473; // 0x10102d1 - field public static final int subtitleTextAppearance = 16843835; // 0x101043b + field public static final int subtitleTextAppearance = 16843829; // 0x1010435 field public static final int subtitleTextStyle = 16843513; // 0x10102f9 field public static final int subtypeExtraValue = 16843674; // 0x101039a field public static final int subtypeId = 16843713; // 0x10103c1 @@ -1114,7 +1109,7 @@ package android { field public static final int switchMinWidth = 16843632; // 0x1010370 field public static final int switchPadding = 16843633; // 0x1010371 field public static final int switchPreferenceStyle = 16843629; // 0x101036d - field public static final int switchStyle = 16843852; // 0x101044c + field public static final int switchStyle = 16843846; // 0x1010446 field public static final int switchTextAppearance = 16843630; // 0x101036e field public static final int switchTextOff = 16843628; // 0x101036c field public static final int switchTextOn = 16843627; // 0x101036b @@ -1151,7 +1146,7 @@ package android { field public static final int textAppearanceLargeInverse = 16842819; // 0x1010043 field public static final int textAppearanceLargePopupMenu = 16843521; // 0x1010301 field public static final int textAppearanceListItem = 16843678; // 0x101039e - field public static final int textAppearanceListItemSecondary = 16843838; // 0x101043e + field public static final int textAppearanceListItemSecondary = 16843832; // 0x1010438 field public static final int textAppearanceListItemSmall = 16843679; // 0x101039f field public static final int textAppearanceMedium = 16842817; // 0x1010041 field public static final int textAppearanceMediumInverse = 16842820; // 0x1010044 @@ -1215,7 +1210,7 @@ package android { field public static final int tintMode = 16843798; // 0x1010416 field public static final int title = 16843233; // 0x10101e1 field public static final int titleCondensed = 16843234; // 0x10101e2 - field public static final int titleTextAppearance = 16843834; // 0x101043a + field public static final int titleTextAppearance = 16843828; // 0x1010434 field public static final int titleTextStyle = 16843512; // 0x10102f8 field public static final int toAlpha = 16843211; // 0x10101cb field public static final int toDegrees = 16843188; // 0x10101b4 @@ -1240,10 +1235,9 @@ package android { field public static final int translationX = 16843554; // 0x1010322 field public static final int translationY = 16843555; // 0x1010323 field public static final int translationZ = 16843797; // 0x1010415 - field public static final int trigger = 16843805; // 0x101041d - field public static final int trimPathEnd = 16843818; // 0x101042a - field public static final int trimPathOffset = 16843819; // 0x101042b - field public static final int trimPathStart = 16843817; // 0x1010429 + field public static final int trimPathEnd = 16843814; // 0x1010426 + field public static final int trimPathOffset = 16843815; // 0x1010427 + field public static final int trimPathStart = 16843813; // 0x1010425 field public static final int type = 16843169; // 0x10101a1 field public static final int typeface = 16842902; // 0x1010096 field public static final int uiOptions = 16843672; // 0x1010398 @@ -1268,8 +1262,8 @@ package android { field public static final int verticalGap = 16843328; // 0x1010240 field public static final int verticalScrollbarPosition = 16843572; // 0x1010334 field public static final int verticalSpacing = 16843029; // 0x1010115 - field public static final int viewportHeight = 16843807; // 0x101041f - field public static final int viewportWidth = 16843806; // 0x101041e + field public static final int viewportHeight = 16843806; // 0x101041e + field public static final int viewportWidth = 16843805; // 0x101041d field public static final int visibility = 16842972; // 0x10100dc field public static final int visible = 16843156; // 0x1010194 field public static final int vmSafeMode = 16843448; // 0x10102b8 @@ -1298,8 +1292,8 @@ package android { field public static final int windowActionBar = 16843469; // 0x10102cd field public static final int windowActionBarOverlay = 16843492; // 0x10102e4 field public static final int windowActionModeOverlay = 16843485; // 0x10102dd - field public static final int windowAllowEnterTransitionOverlap = 16843849; // 0x1010449 - field public static final int windowAllowExitTransitionOverlap = 16843848; // 0x1010448 + field public static final int windowAllowEnterTransitionOverlap = 16843843; // 0x1010443 + field public static final int windowAllowExitTransitionOverlap = 16843842; // 0x1010442 field public static final int windowAnimationStyle = 16842926; // 0x10100ae field public static final int windowBackground = 16842836; // 0x1010054 field public static final int windowCloseOnTouchOutside = 16843611; // 0x101035b @@ -1309,9 +1303,9 @@ package android { field public static final int windowDisablePreview = 16843298; // 0x1010222 field public static final int windowEnableSplitTouch = 16843543; // 0x1010317 field public static final int windowEnterAnimation = 16842932; // 0x10100b4 - field public static final int windowEnterTransition = 16843844; // 0x1010444 + field public static final int windowEnterTransition = 16843838; // 0x101043e field public static final int windowExitAnimation = 16842933; // 0x10100b5 - field public static final int windowExitTransition = 16843845; // 0x1010445 + field public static final int windowExitTransition = 16843839; // 0x101043f field public static final int windowFrame = 16842837; // 0x1010055 field public static final int windowFullscreen = 16843277; // 0x101020d field public static final int windowHideAnimation = 16842935; // 0x10100b7 @@ -1322,8 +1316,8 @@ package android { field public static final int windowNoDisplay = 16843294; // 0x101021e field public static final int windowNoTitle = 16842838; // 0x1010056 field public static final int windowOverscan = 16843727; // 0x10103cf - field public static final int windowSharedElementEnterTransition = 16843846; // 0x1010446 - field public static final int windowSharedElementExitTransition = 16843847; // 0x1010447 + field public static final int windowSharedElementEnterTransition = 16843840; // 0x1010440 + field public static final int windowSharedElementExitTransition = 16843841; // 0x1010441 field public static final int windowShowAnimation = 16842934; // 0x10100b6 field public static final int windowShowWallpaper = 16843410; // 0x1010292 field public static final int windowSoftInputMode = 16843307; // 0x101022b diff --git a/core/res/res/drawable/btn_check_quantum_anim.xml b/core/res/res/drawable/btn_check_quantum_anim.xml index 0600522c77636..4b329ade5ae8d 100644 --- a/core/res/res/drawable/btn_check_quantum_anim.xml +++ b/core/res/res/drawable/btn_check_quantum_anim.xml @@ -14,7 +14,6 @@ --> - - - - - - - - - - - - - - - diff --git a/core/res/res/values/attrs.xml b/core/res/res/values/attrs.xml index 172877f542f7b..d9473ece245af 100644 --- a/core/res/res/values/attrs.xml +++ b/core/res/res/values/attrs.xml @@ -4660,18 +4660,6 @@ - - - - - - - - - - - - @@ -4691,42 +4679,6 @@ - - - - - - - - - - - - - - - - - - - - - - - [] - - - - - - - - - - @@ -4771,26 +4723,6 @@ - - - - - - - - - - - - - - - - - - - - diff --git a/core/res/res/values/public.xml b/core/res/res/values/public.xml index d0cdefe147f5c..4e584c065fcd9 100644 --- a/core/res/res/values/public.xml +++ b/core/res/res/values/public.xml @@ -2116,7 +2116,6 @@ - @@ -2125,17 +2124,12 @@ - - - - - diff --git a/graphics/java/android/graphics/drawable/VectorDrawable.java b/graphics/java/android/graphics/drawable/VectorDrawable.java index 77712b66f023e..ff4ab98ae1d16 100644 --- a/graphics/java/android/graphics/drawable/VectorDrawable.java +++ b/graphics/java/android/graphics/drawable/VectorDrawable.java @@ -14,8 +14,6 @@ package android.graphics.drawable; -import android.animation.ObjectAnimator; -import android.animation.ValueAnimator; import android.content.res.Resources; import android.content.res.Resources.Theme; import android.content.res.TypedArray; @@ -31,9 +29,6 @@ import android.graphics.Region; import android.util.AttributeSet; import android.util.Log; import android.util.Xml; -import android.view.animation.AccelerateDecelerateInterpolator; -import android.view.animation.Interpolator; -import android.view.animation.LinearInterpolator; import com.android.internal.R; @@ -46,7 +41,6 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.Collection; import java.util.HashMap; -import java.util.HashSet; /** * This lets you create a drawable based on an XML vector graphic It can be @@ -56,8 +50,6 @@ import java.util.HashSet; *

*

*
<vector>
- *
The attribute android:trigger defines a state change that - * will drive the animation
*
The attribute android:versionCode defines the version of * VectorDrawable
*
<size>
@@ -68,8 +60,7 @@ import java.util.HashSet; * The size is defined using the attributes android:viewportHeight * android:viewportWidth *
<group>
- *
Defines a "key frame" in the animation if there is only one group the - * drawable is static 2D image that has no animation.
+ *
Defines the static 2D image.
*
<path>
*
Defines paths to be drawn. The path elements must be within a group *
@@ -109,48 +100,6 @@ import java.util.HashSet; *
Sets the lineJoin for a stroked path: miter,round,bevel
*
android:strokeMiterLimit *
Sets the Miter limit for a stroked path
- *
android:state_pressed - *
Sets a condition to be met to draw path
- *
android:state_focused - *
Sets a condition to be met to draw path
- *
android:state_selected - *
Sets a condition to be met to draw path
- *
android:state_window_focused - *
Sets a condition to be met to draw path
- *
android:state_enabled - *
Sets a condition to be met to draw path
- *
android:state_activated - *
Sets a condition to be met to draw path
- *
android:state_accelerated - *
Sets a condition to be met to draw path
- *
android:state_hovered - *
Sets a condition to be met to draw path
- *
android:state_checked - *
Sets a condition to be met to draw path
- *
android:state_checkable - *
Sets a condition to be met to draw path
- *
- *
- *
<animation>
- *
Used to customize the transition between two paths - *
- *
android:sequence - *
Configures this animation sequence between the named paths.
- *
android:limitTo - *
Limits an animation to only interpolate the selected variable unlimited, - * path, rotation, trimPathStart, trimPathEnd, trimPathOffset
- *
android:repeatCount - *
Number of times to loop this aspect of the animation
- *
android:durations - *
The duration of each step in the animation in milliseconds Must contain - * the number of named paths - 1
- *
android:startDelay - *
- *
android:repeatStyle - *
when repeating how does it repeat back and forth or a to b: forward, - * inAndOut
- *
android:animate - *
linear, accelerate, decelerate, easing
*
*
*/ @@ -161,8 +110,6 @@ public class VectorDrawable extends Drawable { private static final String SHAPE_VIEWPORT = "viewport"; private static final String SHAPE_GROUP = "group"; private static final String SHAPE_PATH = "path"; - private static final String SHAPE_TRANSITION = "transition"; - private static final String SHAPE_ANIMATION = "animation"; private static final String SHAPE_VECTOR = "vector"; private static final int LINECAP_BUTT = 0; @@ -173,9 +120,6 @@ public class VectorDrawable extends Drawable { private static final int LINEJOIN_ROUND = 1; private static final int LINEJOIN_BEVEL = 2; - private static final int DEFAULT_DURATION = 1000; - private static final long DEFAULT_INFINITE_DURATION = 60 * 60 * 1000; - private final VectorDrawableState mVectorState; private int mAlpha = 0xFF; @@ -202,7 +146,7 @@ public class VectorDrawable extends Drawable { final int saveCount = canvas.save(); final Rect bounds = getBounds(); canvas.translate(bounds.left, bounds.top); - mVectorState.mVAnimatedPath.draw(canvas, bounds.width(), bounds.height()); + mVectorState.mVPathRenderer.draw(canvas, bounds.width(), bounds.height()); canvas.restoreToCount(saveCount); } @@ -255,12 +199,12 @@ public class VectorDrawable extends Drawable { @Override public int getIntrinsicWidth() { - return (int) mVectorState.mVAnimatedPath.mBaseWidth; + return (int) mVectorState.mVPathRenderer.mBaseWidth; } @Override public int getIntrinsicHeight() { - return (int) mVectorState.mVAnimatedPath.mBaseHeight; + return (int) mVectorState.mVPathRenderer.mBaseHeight; } @Override @@ -276,8 +220,8 @@ public class VectorDrawable extends Drawable { @Override public void inflate(Resources res, XmlPullParser parser, AttributeSet attrs, Theme theme) throws XmlPullParserException, IOException { - final VAnimatedPath p = inflateInternal(res, parser, attrs, theme); - setAnimatedPath(p); + final VPathRenderer p = inflateInternal(res, parser, attrs, theme); + setPathRenderer(p); } @Override @@ -290,7 +234,7 @@ public class VectorDrawable extends Drawable { super.applyTheme(t); final VectorDrawableState state = mVectorState; - final VAnimatedPath path = state.mVAnimatedPath; + final VPathRenderer path = state.mVPathRenderer; if (path != null && path.canApplyTheme()) { path.applyTheme(t); } @@ -316,9 +260,9 @@ public class VectorDrawable extends Drawable { return null; } - private VAnimatedPath inflateInternal(Resources res, XmlPullParser parser, AttributeSet attrs, + private VPathRenderer inflateInternal(Resources res, XmlPullParser parser, AttributeSet attrs, Theme theme) throws XmlPullParserException, IOException { - final VAnimatedPath animatedPath = new VAnimatedPath(); + final VPathRenderer pathRenderer = new VPathRenderer(); boolean noSizeTag = true; boolean noViewportTag = true; @@ -336,23 +280,18 @@ public class VectorDrawable extends Drawable { path.inflate(res, attrs, theme); currentGroup.add(path); noPathTag = false; - } else if (SHAPE_ANIMATION.equals(tagName)) { - final VAnimation anim = new VAnimation(); - anim.inflate(animatedPath.mGroupList, res, attrs, theme); - animatedPath.addAnimation(anim); } else if (SHAPE_SIZE.equals(tagName)) { - animatedPath.parseSize(res, attrs); + pathRenderer.parseSize(res, attrs); noSizeTag = false; } else if (SHAPE_VIEWPORT.equals(tagName)) { - animatedPath.parseViewport(res, attrs); + pathRenderer.parseViewport(res, attrs); noViewportTag = false; } else if (SHAPE_GROUP.equals(tagName)) { currentGroup = new VGroup(); - animatedPath.mGroupList.add(currentGroup); + pathRenderer.mGroupList.add(currentGroup); noGroupTag = false; } else if (SHAPE_VECTOR.equals(tagName)) { final TypedArray a = res.obtainAttributes(attrs, R.styleable.VectorDrawable); - animatedPath.setTrigger(a.getInteger(R.styleable.VectorDrawable_trigger, 0)); // Parsing the version information. // Right now, we only support version "1". @@ -403,23 +342,23 @@ public class VectorDrawable extends Drawable { } // post parse cleanup - animatedPath.parseFinish(); - return animatedPath; + pathRenderer.parseFinish(); + return pathRenderer; } - private void setAnimatedPath(VAnimatedPath animatedPath) { - mVectorState.mVAnimatedPath = animatedPath; + private void setPathRenderer(VPathRenderer pathRenderer) { + mVectorState.mVPathRenderer = pathRenderer; } private static class VectorDrawableState extends ConstantState { int mChangingConfigurations; - VAnimatedPath mVAnimatedPath; + VPathRenderer mVPathRenderer; Rect mPadding; public VectorDrawableState(VectorDrawableState copy) { if (copy != null) { mChangingConfigurations = copy.mChangingConfigurations; - mVAnimatedPath = new VAnimatedPath(copy.mVAnimatedPath); + mVPathRenderer = new VPathRenderer(copy.mVPathRenderer); mPadding = new Rect(copy.mPadding); } } @@ -445,35 +384,16 @@ public class VectorDrawable extends Drawable { } } - private static class VAnimatedPath { - private static final int [] TRIGGER_MAP = { - 0, - R.attr.state_pressed, - R.attr.state_focused, - R.attr.state_hovered, - R.attr.state_selected, - R.attr.state_checkable, - R.attr.state_checked, - R.attr.state_activated, - R.attr.state_focused - }; - + private static class VPathRenderer { private final Path mPath = new Path(); private final Path mRenderPath = new Path(); private final Matrix mMatrix = new Matrix(); - private ArrayList mCurrentAnimList; private VPath[] mCurrentPaths; private Paint mStrokePaint; private Paint mFillPaint; private PathMeasure mPathMeasure; - private int[] mCurrentState = new int[0]; - private float mAnimationValue; - private long mTotalDuration; - private int mTrigger; - private boolean mTriggerState; - final ArrayList mGroupList = new ArrayList(); float mBaseWidth = 1; @@ -481,11 +401,10 @@ public class VectorDrawable extends Drawable { float mViewportWidth; float mViewportHeight; - public VAnimatedPath() { + public VPathRenderer() { } - public VAnimatedPath(VAnimatedPath copy) { - mCurrentAnimList = new ArrayList(copy.mCurrentAnimList); + public VPathRenderer(VPathRenderer copy) { mGroupList.addAll(copy.mGroupList); if (copy.mCurrentPaths != null) { mCurrentPaths = new VPath[copy.mCurrentPaths.length]; @@ -493,15 +412,11 @@ public class VectorDrawable extends Drawable { mCurrentPaths[i] = new VPath(copy.mCurrentPaths[i]); } } - mAnimationValue = copy.mAnimationValue; // time goes from 0 to 1 mBaseWidth = copy.mBaseWidth; mBaseHeight = copy.mBaseHeight; mViewportWidth = copy.mViewportHeight; mViewportHeight = copy.mViewportHeight; - mTotalDuration = copy.mTotalDuration; - mTrigger = copy.mTrigger; - mCurrentState = new int[0]; } public boolean canApplyTheme() { @@ -516,14 +431,6 @@ public class VectorDrawable extends Drawable { } } - final ArrayList anims = mCurrentAnimList; - for (int i = anims.size() - 1; i >= 0; i--) { - final VAnimation anim = anims.get(i); - if (anim.canApplyTheme()) { - return true; - } - } - return false; } @@ -539,70 +446,6 @@ public class VectorDrawable extends Drawable { } } - final ArrayList anims = mCurrentAnimList; - for (int i = anims.size() - 1; i >= 0; i--) { - final VAnimation anim = anims.get(i); - if (anim.canApplyTheme()) { - anim.applyTheme(t); - } - } - } - - public void setTrigger(int trigger){ - mTrigger = VAnimatedPath.getStateForTrigger(trigger); - } - - public long getTotalAnimationDuration() { - mTotalDuration = 0; - int size = mCurrentAnimList.size(); - for (int i = 0; i < size; i++) { - VAnimation vAnimation = mCurrentAnimList.get(i); - long t = vAnimation.getTotalDuration(); - if (t == -1) { - mTotalDuration = -1; - return -1; - } - mTotalDuration = Math.max(mTotalDuration, t); - } - - return mTotalDuration; - } - - public float getValue() { - return mAnimationValue; - } - - /** - * @param value the point along the animations to show typically between 0.0f and 1.0f - * @return true if you need to keep repeating - */ - public boolean setAnimationFraction(float value) { - getTotalAnimationDuration(); - - long animationTime = (long) (value * mTotalDuration); - - final int len = mCurrentPaths.length; - for (int i = 0; i < len; i++) { - animationTime = - (long) ((mTotalDuration == -1) ? value * 1000 : mTotalDuration * value); - - final VPath path = mCurrentPaths[i]; - final int size = mCurrentAnimList.size(); - for (int j = 0; j < size; j++) { - final VAnimation vAnimation = mCurrentAnimList.get(j); - if (vAnimation.doesAdjustPath(path)) { - mCurrentPaths[i] = vAnimation.getPathAtTime(animationTime, path); - } - } - } - - mAnimationValue = value; - - if (mTotalDuration == -1) { - return true; - } else { - return animationTime < mTotalDuration; - } } public void draw(Canvas canvas, int w, int h) { @@ -612,7 +455,7 @@ public class VectorDrawable extends Drawable { } for (int i = 0; i < mCurrentPaths.length; i++) { - if (mCurrentPaths[i] != null && mCurrentPaths[i].isVisible(mCurrentState)) { + if (mCurrentPaths[i] != null) { drawPath(mCurrentPaths[i], canvas, w, h); } } @@ -694,34 +537,10 @@ public class VectorDrawable extends Drawable { } /** - * Ensure there is at least one animation for every path in group (linking them by names) * Build the "current" path based on the first group * TODO: improve memory use & performance or move to C++ */ public void parseFinish() { - final HashMap newAnimations = new HashMap(); - for (VGroup group : mGroupList) { - for (VPath vPath : group.getPaths()) { - if (!vPath.mAnimated) { - VAnimation ap = null; - - if (!newAnimations.containsKey(vPath.getID())) { - newAnimations.put(vPath.getID(), ap = new VAnimation()); - } else { - ap = newAnimations.get(vPath.getID()); - } - - ap.addPath(vPath); - vPath.mAnimated = true; - } - } - } - - if (mCurrentAnimList == null) { - mCurrentAnimList = new ArrayList(); - } - mCurrentAnimList.addAll(newAnimations.values()); - final Collection paths = mGroupList.get(0).getPaths(); mCurrentPaths = paths.toArray(new VPath[paths.size()]); for (int i = 0; i < mCurrentPaths.length; i++) { @@ -729,34 +548,6 @@ public class VectorDrawable extends Drawable { } } - public void setState(int[] state) { - mCurrentState = Arrays.copyOf(state, state.length); - } - - int getTrigger(int []state){ - if (mTrigger == 0) return 0; - for (int i = 0; i < state.length; i++) { - if (state[i] == mTrigger){ - if (mTriggerState) - return 0; - mTriggerState = true; - return 1; - } - } - if (mTriggerState) { - mTriggerState = false; - return -1; - } - return 0; - } - - public void addAnimation(VAnimation anim) { - if (mCurrentAnimList == null) { - mCurrentAnimList = new ArrayList(); - } - mCurrentAnimList.add(anim); - } - private void parseViewport(Resources r, AttributeSet attrs) throws XmlPullParserException { final TypedArray a = r.obtainAttributes(attrs, R.styleable.VectorDrawableViewport); @@ -781,329 +572,6 @@ public class VectorDrawable extends Drawable { a.recycle(); } - private static final int getStateForTrigger(int trigger) { - return TRIGGER_MAP[trigger]; - } - } - - private static class VAnimation { - private static final String SEPARATOR = ","; - - private static final int DIRECTION_FORWARD = 0; - private static final int DIRECTION_IN_AND_OUT = 1; - - public enum Style { - INTERPOLATE, CROSSFADE, WIPE - } - - private final HashSet mSeqMap = new HashSet(); - - private Interpolator mAnimInterpolator = new AccelerateDecelerateInterpolator(); - private VPath[] mPaths = new VPath[0]; - private long[] mDuration = { DEFAULT_DURATION }; - - private int[] mThemeAttrs; - private Style mStyle; - private int mLimitProperty = 0; - private long mStartOffset; - private long mRepeat = 1; - private long mWipeDirection; - private int mMode = DIRECTION_FORWARD; - private int mInterpolatorType; - private String mId; - - public VAnimation() { - // Empty constructor. - } - - public void inflate(ArrayList groups, Resources r, AttributeSet attrs, Theme theme) - throws XmlPullParserException { - String value; - String[] sp; - int name; - - final TypedArray a = r.obtainAttributes(attrs, R.styleable.VectorDrawableAnimation); - final int[] themeAttrs = a.extractThemeAttrs(); - mThemeAttrs = themeAttrs; - - value = a.getString(R.styleable.VectorDrawableAnimation_sequence); - if (value != null) { - sp = value.split(SEPARATOR); - final VectorDrawable.VPath[] paths = new VectorDrawable.VPath[sp.length]; - - for (int j = 0; j < sp.length; j++) { - mSeqMap.add(sp[j].trim()); - - final VectorDrawable.VPath path = groups.get(j).get(sp[j]); - if (path == null) { - throw new XmlPullParserException(a.getPositionDescription() - + " missing path with name: " + sp[j]); - } - - path.mAnimated = true; - paths[j] = path; - } - - setPaths(paths); - } - - name = R.styleable.VectorDrawableAnimation_durations; - value = a.getString(name); - if (value != null) { - long totalDuration = 0; - sp = value.split(SEPARATOR); - - final long[] dur = new long[sp.length]; - for (int j = 0; j < dur.length; j++) { - dur[j] = Long.parseLong(sp[j]); - totalDuration += dur[j]; - } - - if (totalDuration == 0){ - throw new XmlPullParserException(a.getPositionDescription() - + " total duration must not be zero"); - } - - setDuration(dur); - } - - setLimitProperty(a.getInt(R.styleable.VectorDrawableAnimation_limitTo, 0)); - setRepeat(a.getInt(R.styleable.VectorDrawableAnimation_repeatCount, 1)); - setStartOffset(a.getInt(R.styleable.VectorDrawableAnimation_startDelay, 0)); - setMode(a.getInt(R.styleable.VectorDrawableAnimation_repeatStyle, 0)); - - fixMissingParameters(); - - a.recycle(); - } - - public boolean canApplyTheme() { - return mThemeAttrs != null; - } - - public void applyTheme(Theme t) { - // TODO: Apply theme. - } - - public boolean doesAdjustPath(VPath path) { - return mSeqMap.contains(path.getID()); - } - - public String getId() { - if (mId == null) { - mId = mPaths[0].getID(); - for (int i = 1; i < mPaths.length; i++) { - mId += mPaths[i].getID(); - } - } - return mId; - } - - public String getPathName() { - return mPaths[0].getID(); - } - - public Style getStyle() { - return mStyle; - } - - public void setStyle(Style style) { - mStyle = style; - } - - public int getLimitProperty() { - return mLimitProperty; - } - - public void setLimitProperty(int limitProperty) { - mLimitProperty = limitProperty; - } - - public long[] getDuration() { - return mDuration; - } - - public void setDuration(long[] duration) { - mDuration = duration; - } - - public long getRepeat() { - return mRepeat; - } - - public void setRepeat(long repeat) { - mRepeat = repeat; - } - - public long getStartOffset() { - return mStartOffset; - } - - public void setStartOffset(long startOffset) { - mStartOffset = startOffset; - } - - public long getWipeDirection() { - return mWipeDirection; - } - - public void setWipeDirection(long wipeDirection) { - mWipeDirection = wipeDirection; - } - - public int getMode() { - return mMode; - } - - public void setMode(int mode) { - mMode = mode; - } - - public int getInterpolator() { - return mInterpolatorType; - } - - public void setInterpolator(int interpolator) { - mInterpolatorType = interpolator; - } - - /** - * compute the total time in milliseconds - * - * @return the total time in milliseconds the animation will take - */ - public long getTotalDuration() { - long total = mStartOffset; - if (getRepeat() == -1) { - return -1; - } - for (int i = 0; i < mDuration.length; i++) { - if (mRepeat > 1) { - total += mDuration[i] * mRepeat; - } else { - total += mDuration[i]; - } - } - return total; - } - - public void setPaths(VPath[] paths) { - mPaths = paths; - } - - public void addPath(VPath path) { - mPaths = Arrays.copyOf(mPaths, mPaths.length + 1); - mPaths[mPaths.length - 1] = path; - } - - public boolean containsPath(String pathid) { - for (int i = 0; i < mPaths.length; i++) { - if (mPaths[i].getID().equals(pathid)) { - return true; - } - } - return false; - } - - public void interpolate(VPath p1, VPath p2, float time, VPath dest) { - VPath.interpolate(time, p1, p2, dest, mLimitProperty); - } - - public VPath getPathAtTime(long milliseconds, VPath dest) { - if (mPaths.length == 1) { - dest.copyFrom(mPaths[0]); - return dest; - } - long point = milliseconds - mStartOffset; - if (point < 0) { - point = 0; - } - float time = 0; - long sum = mDuration[0]; - for (int i = 1; i < mDuration.length; i++) { - sum += mDuration[i]; - } - - if (mRepeat > 1) { - time = point / (float) (sum * mRepeat); - time = mAnimInterpolator.getInterpolation(time); - - if (mMode == DIRECTION_IN_AND_OUT) { - point = ((long) (time * sum * 2 * mRepeat)) % (sum * 2); - if (point > sum) { - point = sum * 2 - point; - } - } else { - point = ((long) (time * sum * mRepeat)) % sum; - } - } else if (mRepeat == 1) { - time = point / (float) (sum * mRepeat); - time = mAnimInterpolator.getInterpolation(time); - if (mMode == DIRECTION_IN_AND_OUT) { - point = ((long) (time * sum * 2 * mRepeat)); - if (point > sum) { - point = sum * 2 - point; - } - } else { - point = Math.min(((long) (time * sum * mRepeat)), sum); - } - - } else { // repeat = -1 - if (mMode == DIRECTION_IN_AND_OUT) { - point = point % (sum * 2); - if (point > sum) { - point = sum * 2 - point; - } - time = point / (float) sum; - } else { - point = point % sum; - time = point / (float) sum; - } - } - - int transition = 0; - while (point > mDuration[transition]) { - point -= mDuration[transition++]; - } - if (mPaths.length > (transition + 1)) { - if (mPaths[transition].getID() != dest.getID()) { - dest.copyFrom(mPaths[transition]); - } - interpolate(mPaths[transition], mPaths[transition + 1], - point / (float) mDuration[transition], dest); - } else { - interpolate(mPaths[transition], mPaths[transition], 0, dest); - } - return dest; - } - - void fixMissingParameters() { - // fix missing points - float rotation = Float.NaN; - float rotationY = Float.NaN; - float rotationX = Float.NaN; - for (int i = 0; i < mPaths.length; i++) { - if (mPaths[i].mPivotX > 0) { - rotationX = mPaths[i].mPivotX; - } - if (mPaths[i].mPivotY > 0) { - rotationY = mPaths[i].mPivotY; - } - if (mPaths[i].mRotate > 0) { - rotation = mPaths[i].mRotate; - } - } - if (rotation > 0) { - for (int i = 0; i < mPaths.length; i++) { - if (mPaths[i].mPivotX == 0) { - mPaths[i].mPivotX = rotationX; - } - if (mPaths[i].mPivotY == 0) { - mPaths[i].mPivotY = rotationY; - } - } - } - } } private static class VGroup { @@ -1116,10 +584,6 @@ public class VectorDrawable extends Drawable { mVGList.add(path); } - public VPath get(String name) { - return mVGPathMap.get(name); - } - /** * Must return in order of adding * @return ordered list of paths @@ -1128,23 +592,9 @@ public class VectorDrawable extends Drawable { return mVGList; } - public int size() { - return mVGPathMap.size(); - } } private static class VPath { - private static final int LIMIT_ALL = 0; - private static final int LIMIT_PATH = 1; - private static final int LIMIT_ROTATE = 2; - private static final int LIMIT_TRIM_PATH_START = 3; - private static final int LIMIT_TRIM_PATH_OFFSET = 5; - private static final int LIMIT_TRIM_PATH_END = 4; - - private static final int STATE_UNDEFINED=0; - private static final int STATE_TRUE=1; - private static final int STATE_FALSE=2; - private static final int MAX_STATES = 10; private int[] mThemeAttrs; @@ -1165,7 +615,6 @@ public class VectorDrawable extends Drawable { float mTrimPathEnd = 1; float mTrimPathOffset = 0; - boolean mAnimated = false; boolean mClip = false; Paint.Cap mStrokeLineCap = Paint.Cap.BUTT; Paint.Join mStrokeLineJoin = Paint.Join.MITER; @@ -1176,7 +625,6 @@ public class VectorDrawable extends Drawable { private int[] mCheckState = new int[MAX_STATES]; private boolean[] mCheckValue = new boolean[MAX_STATES]; private int mNumberOfStates = 0; - private int mNumberOfTrue = 0; public VPath() { // Empty constructor. @@ -1186,38 +634,6 @@ public class VectorDrawable extends Drawable { copyFrom(p); } - public void addStateFilter(int state, boolean condition) { - int k = 0; - while (k < mNumberOfStates) { - if (mCheckState[mNumberOfStates] == state) - break; - k++; - } - mCheckState[k] = state; - mCheckValue[k] = condition; - if (k==mNumberOfStates){ - mNumberOfStates++; - } - if (condition) { - mNumberOfTrue++; - } - } - - private int getState(int state){ - for (int i = 0; i < mNumberOfStates; i++) { - if (mCheckState[mNumberOfStates] == state){ - return (mCheckValue[i])?STATE_TRUE:STATE_FALSE; - } - } - return STATE_UNDEFINED; - } - /** - * @return the name of the path - */ - public String getName() { - return mId; - } - public void toPath(Path path) { path.reset(); if (mNode != null) { @@ -1342,27 +758,6 @@ public class VectorDrawable extends Drawable { R.styleable.VectorDrawablePath_trimPathStart, mTrimPathStart); } - // TODO: Consider replacing this with existing state attributes. - final int[] states = { - R.styleable.VectorDrawablePath_state_activated, - R.styleable.VectorDrawablePath_state_checkable, - R.styleable.VectorDrawablePath_state_checked, - R.styleable.VectorDrawablePath_state_enabled, - R.styleable.VectorDrawablePath_state_focused, - R.styleable.VectorDrawablePath_state_hovered, - R.styleable.VectorDrawablePath_state_pressed, - R.styleable.VectorDrawablePath_state_selected, - R.styleable.VectorDrawablePath_state_window_focused - }; - - final int N = states.length; - for (int i = 0; i < N; i++) { - final int state = states[i]; - if (a.hasValue(state)) { - addStateFilter(state, a.getBoolean(state, false)); - } - } - updateColorAlphas(); a.recycle(); @@ -1530,7 +925,6 @@ public class VectorDrawable extends Drawable { mRotate = p1.mRotate; mPivotX = p1.mPivotX; mPivotY = p1.mPivotY; - mAnimated = p1.mAnimated; mTrimPathStart = p1.mTrimPathStart; mTrimPathEnd = p1.mTrimPathEnd; mTrimPathOffset = p1.mTrimPathOffset; @@ -1545,118 +939,6 @@ public class VectorDrawable extends Drawable { mFillRule = p1.mFillRule; } - - public static VPath interpolate(float t, VPath p1, VPath p2, VPath returnPath, int limit) { - if (limit == LIMIT_ALL || limit == LIMIT_PATH) { - if (returnPath.mNode == null || returnPath.mNode.length != p1.mNode.length) { - returnPath.mNode = new VNode[p1.mNode.length]; - } - for (int i = 0; i < returnPath.mNode.length; i++) { - if (returnPath.mNode[i] == null) { - returnPath.mNode[i] = new VNode(p1.mNode[i], p2.mNode[i], t); - } else { - returnPath.mNode[i].interpolate(p1.mNode[i], p2.mNode[i], t); - } - } - } - float t1 = 1 - t; - switch (limit) { - case LIMIT_ALL: - returnPath.mRotate = t1 * p1.mRotate + t * p2.mRotate; - returnPath.mPivotX = t1 * p1.mPivotX + t * p2.mPivotX; - returnPath.mPivotY = t1 * p1.mPivotY + t * p2.mPivotY; - returnPath.mClip = p1.mClip | p2.mClip; - - returnPath.mTrimPathStart = t1 * p1.mTrimPathStart + t * p2.mTrimPathStart; - returnPath.mTrimPathEnd = t1 * p1.mTrimPathEnd + t * p2.mTrimPathEnd; - returnPath.mTrimPathOffset = t1 * p1.mTrimPathOffset + t * p2.mTrimPathOffset; - returnPath.mStrokeMiterlimit = - t1 * p1.mStrokeMiterlimit + t * p2.mStrokeMiterlimit; - returnPath.mStrokeLineCap = p1.mStrokeLineCap; - if (returnPath.mStrokeLineCap == null) { - returnPath.mStrokeLineCap = p2.mStrokeLineCap; - } - returnPath.mStrokeLineJoin = p1.mStrokeLineJoin; - if (returnPath.mStrokeLineJoin == null) { - returnPath.mStrokeLineJoin = p2.mStrokeLineJoin; - } - returnPath.mFillRule = p1.mFillRule; - - returnPath.mStrokeColor = rgbInterpolate(t, p1.mStrokeColor, p2.mStrokeColor); - returnPath.mFillColor = rgbInterpolate(t, p1.mFillColor, p2.mFillColor); - returnPath.mStrokeWidth = t1 * p1.mStrokeWidth + t * p2.mStrokeWidth; - returnPath.mNumberOfStates = p1.mNumberOfStates; - for (int i = 0; i < returnPath.mNumberOfStates; i++) { - returnPath.mCheckState[i] = p1.mCheckState[i]; - returnPath.mCheckValue[i] = p1.mCheckValue[i]; - } - for (int i = 0; i < p2.mNumberOfStates; i++) { - returnPath.addStateFilter(p2.mCheckState[i], p2.mCheckValue[i]); - } - - int count = 0; - for (int i = 0; i < returnPath.mNumberOfStates; i++) { - if (returnPath.mCheckValue[i]) { - count++; - } - } - returnPath.mNumberOfTrue = count; - break; - case LIMIT_ROTATE: - returnPath.mRotate = t1 * p1.mRotate + t * p2.mRotate; - break; - case LIMIT_TRIM_PATH_END: - returnPath.mTrimPathEnd = t1 * p1.mTrimPathEnd + t * p2.mTrimPathEnd; - break; - case LIMIT_TRIM_PATH_OFFSET: - returnPath.mTrimPathOffset = t1 * p1.mTrimPathOffset + t * p2.mTrimPathOffset; - break; - case LIMIT_TRIM_PATH_START: - returnPath.mTrimPathStart = t1 * p1.mTrimPathStart + t * p2.mTrimPathStart; - break; - } - return returnPath; - } - - private static int rgbInterpolate(float fraction, int startColor, int endColor) { - if (startColor == endColor) { - return startColor; - } else if (startColor == 0) { - return endColor; - } else if (endColor == 0) { - return startColor; - } - - final int startA = (startColor >> 24) & 0xff; - final int startR = (startColor >> 16) & 0xff; - final int startG = (startColor >> 8) & 0xff; - final int startB = startColor & 0xff; - - final int endA = (endColor >> 24) & 0xff; - final int endR = (endColor >> 16) & 0xff; - final int endG = (endColor >> 8) & 0xff; - final int endB = endColor & 0xff; - - return ((startA + (int)(fraction * (endA - startA))) << 24) | - ((startR + (int)(fraction * (endR - startR))) << 16) | - ((startG + (int)(fraction * (endG - startG))) << 8) | - ((startB + (int)(fraction * (endB - startB)))); - } - - public boolean isVisible(int[] state) { - int match = 0; - for (int i = 0; i < state.length; i++) { - int v = getState(state[i]); - if (v != STATE_UNDEFINED) { - if (v==STATE_TRUE) { - match++; - } else { - return false; - } - } - } - return match == mNumberOfTrue; - } } private static class VNode { @@ -1673,25 +955,6 @@ public class VectorDrawable extends Drawable { mParams = Arrays.copyOf(n.mParams, n.mParams.length); } - public VNode(VNode n1, VNode n2, float t) { - mType = n1.mType; - mParams = new float[n1.mParams.length]; - interpolate(n1, n2, t); - } - - private boolean match(VNode n) { - if (n.mType != mType) { - return false; - } - return (mParams.length == n.mParams.length); - } - - public void interpolate(VNode n1, VNode n2, float t) { - for (int i = 0; i < n1.mParams.length; i++) { - mParams[i] = n1.mParams[i] * (1 - t) + n2.mParams[i] * t; - } - } - public static void createPath(VNode[] node, Path path) { float[] current = new float[4]; char previousCommand = 'm'; @@ -1747,7 +1010,6 @@ public class VectorDrawable extends Drawable { break; } for (int k = 0; k < val.length; k += incr) { - // TODO: build test to prove all permutations work switch (cmd) { case 'm': // moveto - Start a new sub-path (relative) path.rMoveTo(val[k + 0], val[k + 1]); diff --git a/tests/VectorDrawableTest/res/drawable/vector_drawable01.xml b/tests/VectorDrawableTest/res/drawable/vector_drawable01.xml index bb2bebf808331..d0f2a2db366a8 100644 --- a/tests/VectorDrawableTest/res/drawable/vector_drawable01.xml +++ b/tests/VectorDrawableTest/res/drawable/vector_drawable01.xml @@ -14,7 +14,7 @@ limitations under the License. --> + android:versionCode="1" > - - - - - - - - - - - - - - - diff --git a/tests/VectorDrawableTest/res/drawable/vector_drawable02.xml b/tests/VectorDrawableTest/res/drawable/vector_drawable02.xml index 49906d17ebb77..728624a149ac8 100644 --- a/tests/VectorDrawableTest/res/drawable/vector_drawable02.xml +++ b/tests/VectorDrawableTest/res/drawable/vector_drawable02.xml @@ -21,14 +21,6 @@ - - - - diff --git a/tests/VectorDrawableTest/res/drawable/vector_drawable03.xml b/tests/VectorDrawableTest/res/drawable/vector_drawable03.xml index 137049df2476c..179268357815d 100644 --- a/tests/VectorDrawableTest/res/drawable/vector_drawable03.xml +++ b/tests/VectorDrawableTest/res/drawable/vector_drawable03.xml @@ -71,67 +71,4 @@ android:fill="#ff88ff" /> - - - - - - - - - - - - - diff --git a/tests/VectorDrawableTest/res/drawable/vector_drawable04.xml b/tests/VectorDrawableTest/res/drawable/vector_drawable04.xml index cffb73f36b899..90694fbbc123b 100644 --- a/tests/VectorDrawableTest/res/drawable/vector_drawable04.xml +++ b/tests/VectorDrawableTest/res/drawable/vector_drawable04.xml @@ -65,62 +65,4 @@ android:fill="#ff88ff" /> - - - - - - - - - - - - - - diff --git a/tests/VectorDrawableTest/res/drawable/vector_drawable05.xml b/tests/VectorDrawableTest/res/drawable/vector_drawable05.xml index 0be67558856d0..c6595facbe667 100644 --- a/tests/VectorDrawableTest/res/drawable/vector_drawable05.xml +++ b/tests/VectorDrawableTest/res/drawable/vector_drawable05.xml @@ -44,95 +44,4 @@ q -0.203125,0.484375 -0.734375,1.140625 -0.15625,0.171875 -0.9375,0.984375 q -0.78125024,0.8125 -2.2187502,2.265625Z" /> - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/tests/VectorDrawableTest/res/drawable/vector_drawable06.xml b/tests/VectorDrawableTest/res/drawable/vector_drawable06.xml index 73ff5e2e9837a..850de28965000 100644 --- a/tests/VectorDrawableTest/res/drawable/vector_drawable06.xml +++ b/tests/VectorDrawableTest/res/drawable/vector_drawable06.xml @@ -22,29 +22,6 @@ android:viewportWidth="700" android:viewportHeight="700"/> - - - - - - - - - - - diff --git a/tests/VectorDrawableTest/res/drawable/vector_drawable07.xml b/tests/VectorDrawableTest/res/drawable/vector_drawable07.xml index 99d37efe338f0..7c7e679a3d1e6 100644 --- a/tests/VectorDrawableTest/res/drawable/vector_drawable07.xml +++ b/tests/VectorDrawableTest/res/drawable/vector_drawable07.xml @@ -19,14 +19,7 @@ - - - + - - - diff --git a/tests/VectorDrawableTest/res/drawable/vector_drawable08.xml b/tests/VectorDrawableTest/res/drawable/vector_drawable08.xml index f8a03d761714a..59f745942dc7f 100644 --- a/tests/VectorDrawableTest/res/drawable/vector_drawable08.xml +++ b/tests/VectorDrawableTest/res/drawable/vector_drawable08.xml @@ -31,18 +31,4 @@ android:strokeWidth="1"/> - - - - - - - diff --git a/tests/VectorDrawableTest/res/drawable/vector_drawable09.xml b/tests/VectorDrawableTest/res/drawable/vector_drawable09.xml index b3c91a88bcedb..2e379d675b094 100644 --- a/tests/VectorDrawableTest/res/drawable/vector_drawable09.xml +++ b/tests/VectorDrawableTest/res/drawable/vector_drawable09.xml @@ -23,12 +23,6 @@ android:viewportHeight="200" android:viewportWidth="200" /> - - - - - \ No newline at end of file diff --git a/tests/VectorDrawableTest/res/drawable/vector_drawable10.xml b/tests/VectorDrawableTest/res/drawable/vector_drawable10.xml index 7aca16960f7e1..8484e9e2f1076 100644 --- a/tests/VectorDrawableTest/res/drawable/vector_drawable10.xml +++ b/tests/VectorDrawableTest/res/drawable/vector_drawable10.xml @@ -21,27 +21,9 @@ android:width="64dp" /> + android:viewportWidth="200" + android:viewportHeight="200"/> - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/tests/VectorDrawableTest/res/drawable/vector_drawable11.xml b/tests/VectorDrawableTest/res/drawable/vector_drawable11.xml index a4403c5a9c506..2b6c5d31b32ac 100644 --- a/tests/VectorDrawableTest/res/drawable/vector_drawable11.xml +++ b/tests/VectorDrawableTest/res/drawable/vector_drawable11.xml @@ -36,25 +36,5 @@ android:fill="#FFFF0000" android:pathData="M 30,18.031528 L 25.579581,23.421071 L 29.370621,26.765348 L 20.096792,37 L 21.156922,28.014053 L 17,24.902844 L 20.880632,18 L 30,18.031528 z" /> - - - - - - - \ No newline at end of file diff --git a/tests/VectorDrawableTest/res/drawable/vector_drawable12.xml b/tests/VectorDrawableTest/res/drawable/vector_drawable12.xml index 207879d6ab356..681eb4faf099a 100644 --- a/tests/VectorDrawableTest/res/drawable/vector_drawable12.xml +++ b/tests/VectorDrawableTest/res/drawable/vector_drawable12.xml @@ -40,48 +40,5 @@ android:pivotY="300" android:rotation="0" /> - - - - - - - - \ No newline at end of file diff --git a/tests/VectorDrawableTest/res/drawable/vector_drawable13.xml b/tests/VectorDrawableTest/res/drawable/vector_drawable13.xml index 4a2ed90c6f5f5..ef1b8e4cba331 100644 --- a/tests/VectorDrawableTest/res/drawable/vector_drawable13.xml +++ b/tests/VectorDrawableTest/res/drawable/vector_drawable13.xml @@ -40,40 +40,5 @@ android:stroke="#FF0000FF" android:strokeWidth="5" /> - - - - - - - \ No newline at end of file diff --git a/tests/VectorDrawableTest/res/drawable/vector_drawable14.xml b/tests/VectorDrawableTest/res/drawable/vector_drawable14.xml index 6ebd56b41bd81..77bf7232c9afb 100644 --- a/tests/VectorDrawableTest/res/drawable/vector_drawable14.xml +++ b/tests/VectorDrawableTest/res/drawable/vector_drawable14.xml @@ -23,17 +23,6 @@ android:viewportHeight="500" android:viewportWidth="800" /> - - - - - \ No newline at end of file diff --git a/tests/VectorDrawableTest/res/drawable/vector_drawable15.xml b/tests/VectorDrawableTest/res/drawable/vector_drawable15.xml index 3c92d25cc0b76..df5838c53e01c 100644 --- a/tests/VectorDrawableTest/res/drawable/vector_drawable15.xml +++ b/tests/VectorDrawableTest/res/drawable/vector_drawable15.xml @@ -23,14 +23,6 @@ android:viewportHeight="400" android:viewportWidth="500" /> - - - - - \ No newline at end of file diff --git a/tests/VectorDrawableTest/res/drawable/vector_drawable16.xml b/tests/VectorDrawableTest/res/drawable/vector_drawable16.xml index 7e757a5f142c4..0bdcda5646039 100644 --- a/tests/VectorDrawableTest/res/drawable/vector_drawable16.xml +++ b/tests/VectorDrawableTest/res/drawable/vector_drawable16.xml @@ -23,13 +23,6 @@ android:viewportHeight="200" android:viewportWidth="200" /> - - - - - \ No newline at end of file diff --git a/tests/VectorDrawableTest/res/drawable/vector_drawable17.xml b/tests/VectorDrawableTest/res/drawable/vector_drawable17.xml index 9427652a1950a..4453ae4b3569f 100644 --- a/tests/VectorDrawableTest/res/drawable/vector_drawable17.xml +++ b/tests/VectorDrawableTest/res/drawable/vector_drawable17.xml @@ -21,14 +21,6 @@ - - - - - - - diff --git a/tests/VectorDrawableTest/res/drawable/vector_drawable18.xml b/tests/VectorDrawableTest/res/drawable/vector_drawable18.xml index 69212f5dc01d0..dfae9acb122d8 100644 --- a/tests/VectorDrawableTest/res/drawable/vector_drawable18.xml +++ b/tests/VectorDrawableTest/res/drawable/vector_drawable18.xml @@ -23,13 +23,6 @@ android:viewportHeight="400" android:viewportWidth="500" /> - - - - - \ No newline at end of file diff --git a/tests/VectorDrawableTest/res/drawable/vector_drawable19.xml b/tests/VectorDrawableTest/res/drawable/vector_drawable19.xml index 2dca48d9c87d8..a890fd6a8874e 100644 --- a/tests/VectorDrawableTest/res/drawable/vector_drawable19.xml +++ b/tests/VectorDrawableTest/res/drawable/vector_drawable19.xml @@ -23,13 +23,6 @@ android:viewportHeight="800" android:viewportWidth="1000" /> - - - - - \ No newline at end of file